• 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: NSImage size?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage size?


  • Subject: Re: NSImage size?
  • From: Ken Tozier <email@hidden>
  • Date: Mon, 23 May 2005 19:05:57 -0400

Not sure if this has anything to do with the problem, but it looks like the 1036.8 x 777.6 dimensions equal 2592 x 1944 at 40 percent. Looking at the screen resolutions in the monitor control pane, the final dimensions are in the ball park of two screen resolutions

1024 x 768
1152 x 768

Perhaps NSImage is scaling the images to the best fit for the current screen resolution?

Just a thought.

Ken


On May 23, 2005, at 4:59 PM, Bret Kurth wrote:

I am writing an image layout type of application that, upon opening files, requires the width and height in pixels of images as stored on disk. The following code snippet gives me that information on 10.3.9 and prior versions of the OS but fails on 10.4 only with certain JPEG files:


NSImage *image = [[NSImage allocWithZone:[self zone]] initWithContentsOfFile:imagepath];
NSSize size = [image size];


Eliminating the obvious; the file exists at "imagepath" and opens/ loads correctly. The image on disk is 2592 x 1944. The "size" message returns 1036.8 x 777.6 consistently on multiple 10.4 machines. Both iPhoto and Preview show the correct size of the image in pixels. Apple's Sketch example and my application fail. In a last ditch effort, I tried the following but both "pixelsWide" and "pixelsHigh" return zero:

NSImage *image = [[NSImage allocWithZone:[self zone]] initWithContentsOfFile:imagepath];
NSBitmapImageRep *bitmap = [NSBitmapImageRep imageRepWithData: [image TIFFRepresentation]];
if (bitmap != nil)
{
NSLog( @"rep size: w=%f, h=%f\n", [bitmap pixelsWide], [bitmap pixelsHigh] );
}


Any ideas or suggestions would be appreciated.

Bret
iDevelop _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40comcast.net


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >NSImage size? (From: Bret Kurth <email@hidden>)

  • Prev by Date: CIContext and performance differences
  • Next by Date: Re: NSImage size?
  • Previous by thread: NSImage size?
  • Next by thread: Re: NSImage size?
  • Index(es):
    • Date
    • Thread