On Aug 31, 2006, at 5:23 PM, Dr Gerard Hammond wrote:
If I have a picture object instantiated in RB, what are good
options for generating and saving a jpeg thumbnail?
My first idea was to iterate though the pixels and copy every, say,
5th pixel into another picture object then save that to disk.
Do you have any other suggestions on creating thumbnails?
I guess I could use the graphics.drawpicture method (with all it's
scaling parameters) to draw the original image into a small picture
variable, then write that out to the smaller image to disk.
Perhaps someone has some alternatives?
It is a lot faster, and better quality, to let REALbasic and the OS
resize the image for you using the Graphics.DrawPicture scale
options. Plugins might be even faster though.
Besides, then you can have a uniform size for all thumbnails (120 x
120 for example) which would make your first idea a lot more
complex. Your first idea is only really practical in pure REALbasic
code if you have to (or want to) parse the Image file format
yourself. I don't remember who it was for, but I did write something
similar for a 16-bit grayscale image that was just stored in raw bytes.
It is actually the calls into Graphics.Pixel() which are the most
expensive (I know that you are suppose to use a RGBSurface now, but
they got a lot slower in 2005+ and I have experienced crashes and
corrupted pixels). This got so bad, that I have started working on a
Plugin to handle graphic routines that I need.
There is one other option, but I don't know where to look for the
answer. It might be possible that you can request a thumbnail
directly from OS X... such as what the Finder shows in the when you
"GetOpenFolderItem" in column mode.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>