NSImage/BitmapRep behavior
NSImage/BitmapRep behavior
- Subject: NSImage/BitmapRep behavior
- From: Ben Zotto <email@hidden>
- Date: Sat, 23 Dec 2006 08:26:20 -0800 (PST)
Hi all,
I'm hoping someone can help me understand the following behavior so I can better understand what's happening in some of my image management code.
I load a large JPEG (pretty standard, from a digital camera) into an NSImage via -initWithContentsOfFile:. The JPEG has a resolution of 2592 x 1944. This is the same as the pixelsWide/pixelsHigh given by the NSBitmapImageRep representation. I have not yet drawn the NSImage into anything, so it has not yet become a cached image. But the -size method on NSImage returns a size of 1036.800049x777.599976. Why? This size doesn't seem to be some multiple of the pixel resolution of the image (or any relation to the size of the view which it will later be drawn into).
I ran some NSLogging on the NSImage and its reps before and after drawing the image. Here are the results:
****
NSImage size: 1036.800049 x 777.599976
rep: NSBitmapImageRep 0x3568b0 Size={1036.8, 777.6} ColorSpace=NSCalibratedRGBColorSpace BPS=8 BPP=24 Pixels=2592x1944 Alpha=NO Planar=NO Format=0
NSImageRep pix: 2592 x 1944
/* draw the NSImage once onto a view, then repeat the above: */
NSImage size: 1036.800049 x 777.599976
rep: NSCachedImageRep 0x388c50 Size={1037, 778} ColorSpace=NSCalibratedRGBColorSpace BPS=8 Pixels=1037x778 Alpha=NO
NSImageRep pix: 1037 x 778
****
It all makes total sense to me, except I can't figure out where those initial 1037x778 dimensions are coming from! I'm hoping to use some related code to save back out "thumbnail" (smaller than original, hopefully more precooked for screen display) bitmaps, but I really want to understand what's happening here so I can grok or control the image quality/efficiency.
Any thoughts?
Thanks (and happy holidays),
Ben
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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