• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Comparing NSImages
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Comparing NSImages


  • Subject: Comparing NSImages
  • From: Benjamin Rister <email@hidden>
  • Date: Thu, 23 Jul 2009 17:00:21 -0400

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


  • Follow-Ups:
    • Re: Comparing NSImages
      • From: "John C. Randolph" <email@hidden>
    • Re: Comparing NSImages
      • From: Nick Zitzmann <email@hidden>
    • Re: Comparing NSImages
      • From: Sandy McGuffog <email@hidden>
  • Prev by Date: Re: NSSliderCell question
  • Next by Date: Re: NSSliderCell question
  • Previous by thread: Re: NSSliderCell question
  • Next by thread: Re: Comparing NSImages
  • Index(es):
    • Date
    • Thread