As a follow on to a previous thread on thumbnails, I finally settled on using Image I/O for creating a thumbnail from a file using a CGImageRef. However I could still use an NSImageView or an IKImageView to display the image. NSImageView requires converting the CGImageRef to an NSImage, with a few lines of code, whereas a CGImageRef can be set directly into the IKImageView. Generally the NSImageView approach uses a lot less memory than IKImageView, and also the IKImageView seems to leak memory. (Although Instruments Leaks doesn't show the leaks.)

So NSImageView seems the way to go, however there is one nice side effect for the IKImageView. In my app, I accept edits in a window, save the edits to a file, close the window, then reopen the window to show the changes. With an NSImageView, you get an annoying flash when the window closes and then opens again. With an IKImageView you don't get the flash -- you can barely tell that the window has closed and opened again. Much better appearance- wise.
I am not sure why there is this difference between the two.

So that's my conclusion -- if you just need thumbnails (with no image editing other than scaling and rotation) use Image I/O.

Jim Merkel

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to