Re: Once and for all! Fastest way to load large jpeg
- From: jimbo@xxxxxxxxxx
- Date: 11 Dec 2006 00:18:14 -0800
Nicholas Sherlock wrote:
jimbo@xxxxxxxxxx wrote:Nicolas thanks for the IncludeTrailingBackslash. (Delphi newbie). Does
Here is what I'm using. It's the culmination of ablout 50 threads I've
chased.
Sender is a TImage (Thumbnail) and when it's loaded the tag property is
set
to it's offset in a thumb grid. On larger images, 4 - 8 MB it's slow.
You're already taking advantage of the Jpeg scaling to reduce the amount
of data loaded. Try this, there should be less shuffling around:
procedure MyPicLoader(Sender: TObject);
Var
Offset, Size: Integer;
Pic: TPicture;
F: file of byte;
Begin
Offset := (Sender as TComponent).Tag;
// get size of file. I assume there's a better/faster way.
AssignFile(f, IncludeTrailingBackSlash(filelistbox1.Directory) +
filelistbox1.Items[offset]);
Reset(f);
Size := Round(filesize(f)/1000);
closefile(f);
BigPic.Picture.LoadFromFile(IncludeTrailingBackSlash(filelistbox1.Directory
) + filelistbox1.Items[Offset]);
with TJpegImage(BigPic.Picture.Graphic) do
Begin
if (Size > 2000) then
Scale := jseighth
else if (Size > 800) and (Size <= 2000) then
Scale := jsquarter
else if (Size > 400) and (Size <= 800) then
Scale := jshalf;
Performance := jpBestSpeed;
End;
End;
Cheers,
Nicholas Sherlock
the jpeg.scale need to be set before the call to jpeg.loadfromfile? In
my search for an answer I recall this being a point of debate but
haven't played with it. It would seem logical. Does setting the scale
after loading cause a re-read of every so many lines? How do the two
work together? Also I saw a reference to the possibility of multiple
scaling possibly using two jpeg objects but couldn't understand it and
lost the reference in the myriad. BTW I recall landing on your site in
my travels. Any help or insight will be appreciated. Thanks again.
Jim
--
http://www.sherlocksoftware.org
.
- Follow-Ups:
- Re: Once and for all! Fastest way to load large jpeg
- From: Nicholas Sherlock
- Re: Once and for all! Fastest way to load large jpeg
- References:
- Once and for all! Fastest way to load large jpeg
- From: jimbo
- Re: Once and for all! Fastest way to load large jpeg
- From: Nicholas Sherlock
- Once and for all! Fastest way to load large jpeg
- Prev by Date: Re: Once and for all! Fastest way to load large jpeg
- Next by Date: Re: Once and for all! Fastest way to load large jpeg
- Previous by thread: Re: Once and for all! Fastest way to load large jpeg
- Next by thread: Re: Once and for all! Fastest way to load large jpeg
- Index(es):
Relevant Pages
|