Create faster preview for pictures?

Just starting out? Need help? Post your questions and find answers here.
omit59
User
User
Posts: 63
Joined: Fri Mar 11, 2005 8:41 am
Location: Finland

Create faster preview for pictures?

Post by omit59 »

I'm using loadimage() and then resizeimage() to make a directory preview for pictures, but if there are many pictures in the directory it takes quite along time to do that.

Is there any other way to do this (mayby API) faster???

Timo
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

Jumped on this somewhere (works in XP only, AFAIK):
You can extract thumbnails by calling IShellFolder::GetUIObjectOf to obtain an IExtractImage interface for each item you're interested in. But unfortunately you don't get a free ride on the shell's thumbnail cache.
Apparently, that's what all these thumbs.db files are about...
El_Choni
omit59
User
User
Posts: 63
Joined: Fri Mar 11, 2005 8:41 am
Location: Finland

Post by omit59 »

OK, I will use LoadImage() and just wait a little longer...

Thanks El_Choni

Timo
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Make sure you've set the resize mode to raw and not interpolated with the ResizeImage command. It's an optional parameter that's set to interpolated by default. That is nicer but much slower.
omit59
User
User
Posts: 63
Joined: Fri Mar 11, 2005 8:41 am
Location: Finland

Post by omit59 »

That was really good point, I didn't even think that interpolated parameter was used by default. Time save is about 20%, and preview is good enough!

Thanks a lot Trond

Timo
Pantcho!!
Enthusiast
Enthusiast
Posts: 538
Joined: Tue Feb 24, 2004 3:43 am
Location: Israel
Contact:

Post by Pantcho!! »

Yeah! thanks alot this is damn faster!!

8)
Hurga
Enthusiast
Enthusiast
Posts: 148
Joined: Thu Jul 17, 2003 2:53 pm
Contact:

Post by Hurga »

Just a thought, not sure if its really faster...

Here a piece of pseudo code

Code: Select all

Load the file of the image in memory (not as an image)
get the pointer of the first pixel.
original size i.e. 100x300
create image 10x30
if in the example the size reduction in 10, so add 10 to the pointer and get the next pixel there.
Write the pixels in a new created image.
Maybe its a bit faster then load image, resize image and so on.
Yogi Yang
Enthusiast
Enthusiast
Posts: 107
Joined: Sun Dec 11, 2005 2:19 pm

Post by Yogi Yang »

I think for all kinds of very fast and accurate image manuplations you should use ImageMagick which is OpenSource and really very very powerfull.

http://www.imagemagick.org

I use its varient GraphicsMagick - graphicsmagick.org which is a COM version of ImageMagick in VB whenever I have to deal with images. Use this only if you do not want to convert the image data to PB's internal image format.

Hope this helps
Post Reply