• 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
Re: Jaguar NSImage Mystery: Why is -size lying?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Jaguar NSImage Mystery: Why is -size lying?


  • Subject: Re: Jaguar NSImage Mystery: Why is -size lying?
  • From: Cameron Hayne <email@hidden>
  • Date: Fri, 6 Sep 2002 03:57:59 -0400

On Friday, September 6, 2002, at 12:40 am, Steven W. Schuldt wrote:

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.

Your sample image is of resolution 300 dpi and hence its 799x854 pixels have a size of 2.7 x 2.8 inches. If you display this image on a screen with a resolution of 72 dpi, you will naturally get an image of about 1/4 the size in terms of pixels. It seems that this is what [NSImage size] is giving you. Maybe setScalesWhenResized would help?

--
Cameron Hayne (email@hidden)
Hayne of Tintagel
_______________________________________________
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.

References: 
 >Jaguar NSImage Mystery: Why is -size lying? (From: "Steven W. Schuldt" <email@hidden>)

  • Prev by Date: Abstract classes
  • Next by Date: NSTextField setFloatValue broken?
  • Previous by thread: Jaguar NSImage Mystery: Why is -size lying?
  • Next by thread: NSImage Shrinking JPEGs Mystery Solved
  • Index(es):
    • Date
    • Thread