Jaguar NSImage Mystery: Why is -size lying?
Jaguar NSImage Mystery: Why is -size lying?
- Subject: Jaguar NSImage Mystery: Why is -size lying?
- From: "Steven W. Schuldt" <email@hidden>
- Date: Thu, 5 Sep 2002 21:40:37 -0700
All,
I'm seeing some strange behavior I really don't understand. When I
load a simple jpg like this one:
http://www.ibiblio.org/wm/paint/auth/cornell/cornell.tilly-losch.jpg
using:
theImage = [[NSImage alloc] initWithData:<the jpg data>];
I can write out an a TIFFRepresentation like so:
[[theImage TIFFRepresentation] writeToFile:@"/some/path"
atomically:YES];
and the result is a great big 799X854 tiff file. Very nice. However,
if I ask this same image its size using:
NSSize mySize = [theImage size];
I'm given an NSSize something slightly less than 1/4 the correct size.
This has the dastardly effect of rendering me to be unable to display
the image in an NSImageView at its true resolution. Tried many ways to
"fool" Cocoa into generating an NSImageView at the correct size and
resolution but no luck. This is causing myself and my app much grief.
How can I get that data (I know it's in there!) from my NSImage into
an NSImageView at full size and resolution?
Essentially, no matter what I try I keep ending up with an NSImage the
same resolution as you see when that jpg is dropped into TextEdit as
opposed to when it's displayed in OmniWeb or Preview.app.
Kudos to the person who can explain what's going on and how to work
around it. Thanks!
- Steven
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.