Re: Once and for all! Fastest way to load large jpeg



On 13 Dec 2006 21:42:50 -0800, jimbo@xxxxxxxxxx wrote:


<snip>
How about kicking off a separate App that generates the thumbnails in
the back ground, that way you'll be using the processor while the user
is twiddling with the mouse.

The thumbs are no problem.

<snip>

User chooses folder from directorylistbox populating a filelistbox.
I create an object for each entry with path and other relevant info and
add it to an array with a common index to the filelistbox. So I use
whichever is convenient.

Where exactly are those JPEGs coming from

CD USB or any external drive.

How long do you want to keep the JPEGs

In practice only long enough to assign it to the larger TImage. I free
it immediately. See original example.
<snip>

Could you explain the 4mb
- do you mean that a 4mb file is slow to load ?

Yes from external media. I orginally tested with 2MB files from various
cameras. When I started testing with larger 4MB+ files the speed is
borderline acceptable. I need to improve loading the image from disk
somehow in order to properly support large files.

If that is the case, you could try reading the entire file into a
memory stream and then use LoadFromStream
- I'm not sure, but it could cut down on physical disk reads

I found this. Would this help?
var
bm2: TBitmap;
st: TMemoryStream;
begin
bm2:= TBitmap.Create;

bm2.PixelFormat := pf24bit;
bm2.Width := 256 ;
bm2.Height := 256 ;

st := TMemoryStream.Create;
bm2.SaveToStream (st);
st.Seek( - (256*256*3), soFromEnd);
st.WriteBuffer( ColorArray[ScrollPos,0,0,1] , 256*256*3);
st.Seek(0, soFromBeginning );
bm2.LoadFromStream(st);
Image1.Picture.Bitmap := bm2;
bm2.Destroy ;
st.Destroy;

end;

The above code is just creating a sort of emptyish Bitmap and shoving
it into an Image.

What I would do is to take one of your large Bitmaps, load it into a
TMemoryStream then load the image from the TMemoryStream

If you have FileMon, you could check how many file reads are made on
the jpg on the CD - it might well be that there are hundreds of them

Things like this are normally slow because of excessive disk activity.

You also might try looking for a TBufferedStream component, I wrote
one some time ago, but being an idiot did not descend it from an
abstract TStream. I'm too ashamed to post or distribute it.
The improvement in reading and writing speeds was incredible.



.



Relevant Pages

  • Re: Shopping for Blu-Ray
    ... Howard Brazee wrote: ... In spite of its odd look compared to a classic player, it is the single best BluRay player out there. ... And while they may not be the fastest to load a disk, I've always wondered why this aspect is always mentioned. ...
    (alt.tv.tech.hdtv)
  • Re: SATA 3ware RAID review...sort of.
    ... indicate the load you are putting on the card or the harddrives. ... of sustained disk transfer. ... how many hits the server serves every second. ... >setup though so I was concerned about moving over to SATA for something ...
    (freebsd-isp)
  • Re: XP Pro OEM installs, Academic Upgrade doesnt
    ... He says I am NOT supposed to load ... the NVidia RAID driver if I have one disk. ... he also says that you can't use an "upgrade" version of Windows XP to ... > connectors but there is also the possibility that only certain connectors ...
    (microsoft.public.windowsxp.setup_deployment)
  • Re: "Load Balancing": How Busy are the servers?
    ... processes are waiting for disk. ... The fault columnshow how badly your system is accesing swap. ... If you look at swapinfo and you have a large amount of swap in use and then you see a high number in vmstat for fault, the machine is short on RAM for the load you have on it. ...
    (freebsd-questions)
  • Re: Store MEM block to DB field?
    ... > How to store a a MEM blockto a DB field? ... > can load it back? ... Use a TMemoryStream to write the block to a TBlobStream. ...
    (borland.public.delphi.language.objectpascal)