Re: Comparing NSImages
Re: Comparing NSImages
- Subject: Re: Comparing NSImages
- From: Sandy McGuffog <email@hidden>
- Date: Thu, 23 Jul 2009 23:16:21 +0200
Well, before you worry about release differences, you should probably
worry about the "NSDeviceRGBColorSpace" - if you want consistency
between different platforms, I'd think you should be using sRGB, Adobe
RGB or similar.
Sandy
On Jul 23, 2009, at 11:00 PM, Benjamin Rister wrote:
We're having problems where the same code is producing corrupt
output on certain OS versions but not others. We're trying to track
this down, but are running into issues trying to verify intermediate
results in the process, in particular NSImage data.
Question 1: Is it normal for [NSImage TIFFRepresentation] to differ
from release to release on identical images? There are pieces of
very basic code [1] that are producing NSImages with different
TIFFRepresentations on the same input on the different OSes, so I'm
not convinced that's a reliable way to tell whether it's producing
the expected output.
Question 2: Assuming TIFFRepresentation isn't unique, what's the
best practice to verify programmatically, say in a unit test, that
the output matches an expected output?
Thanks,
Benjamin Rister
[1] Very basic code:
// input is NSImage* img, identical on both OSes (TIFFRepresentation
exactly identical)
int height = [img size].height;
int width = [img size].width;
NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes:NULL
pixelsWide:width
pixelsHigh:height
bitsPerSample:8
samplesPerPixel:3
hasAlpha:NO
isPlanar:NO
colorSpaceName:NSDeviceRGBColorSpace
bytesPerRow:width * 3
bitsPerPixel:24];
NSImage *newImage = [[NSImage alloc] init];
[newImage addRepresentation:imageRep];
[imageRep release];
[newImage lockFocus];
NSRect imgRect = NSMakeRect(0,0,width,height);
[img drawInRect:imgRect fromRect:imgRect
operation:NSCompositeSourceOver fraction:1.0f];
[newImage unlockFocus];
// output [newImage TIFFRepresentation] is different on the
different OSes
_______________________________________________
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
_______________________________________________
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