Page 1 of 1
Create faster preview for pictures?
Posted: Thu Oct 27, 2005 9:36 am
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
Posted: Thu Oct 27, 2005 5:00 pm
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...
Posted: Thu Oct 27, 2005 5:15 pm
by omit59
OK, I will use LoadImage() and just wait a little longer...
Thanks El_Choni
Timo
Posted: Thu Oct 27, 2005 5:46 pm
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.
Posted: Fri Oct 28, 2005 5:58 am
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
Posted: Fri Oct 28, 2005 11:33 am
by Pantcho!!
Yeah! thanks alot this is damn faster!!

Posted: Fri Oct 28, 2005 1:24 pm
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.
Posted: Tue Nov 14, 2006 10:11 am
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