Re: some questions about creating image thumbnails
Re: some questions about creating image thumbnails
- Subject: Re: some questions about creating image thumbnails
- From: Ben Lachman <email@hidden>
- Date: Thu, 10 Apr 2008 02:19:00 -0400
You should look into JPEG2000. It allows for sequential reading to
generate thumbnails, e.g. you read the first 200B and get an X sized
thumbnail, you read the first 1KB and you get a Y sized thumbnail
(where Y > X), etc. It is supported on both tiger and leopard.
Performance on Tiger is rather slow, however on Leopard it is
_faster_ than regular JPEG. I'm using it on tiger and it is
acceptable for my use (images stored in CoreData and cached as
thumbnails).
Wil Shipley wrote a blog post on it a while back (the tiger
implementation):
http://www.wilshipley.com/blog/2005/09/jpeg2000-cool-but-slow.html
The other nice thing about JPEG2000 is that the file size is a bit
smaller than even regular JPEG and the quality is better.
->Ben
--
Ben Lachman
Acacia Tree Software
http://acaciatreesoftware.com
email@hidden
740.590.0009
On Apr 9, 2008, at 11:32 AM, Jesse Grosjean wrote:
I have a situation where I've got a NSImage reference in memory and
I'd like to save that image at full size and in a number of
thumbnail sizes as quickly as possible. I know how to implement the
basics, but I have no idea if I'm doing it in the most efficient
way. In particular:
To save the full sizes image I'm using some code like this:
[[artworkImage
TIFFRepresentationUsingCompression:NSTIFFCompressionNone factor:0]
writeToFile:file atomically:NO]
That brings up these questions:
1. If I don't care about on disk size is NSTIFFCompressionNone a
fast way to write? (assuming that compression would take more
time). Or maybe compression will actually save me time since the
disk write will be faster?
2. And how does the image format effect read time, after all that's
what I'm really trying to optimize in the first place by creating
the caches?
2. Is TIFFRepresentation a good way to go or should I really be
using some other framework like image IO or something else if I'm
concerned with efficiency.
For the thumbnails I'm just creating new NSImages of the correct
size, locking focus on them, and then drawing the original image
into the smaller image, and writing them out as above. Is there a
smarter way? I've heard (or maybe imagined) that some image file
formats will already embed their own thumbnails. Is that a better
way to do things... what image formats support that if any?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden