• 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: Problem of resolution with JPEGs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem of resolution with JPEGs


  • Subject: Re: Problem of resolution with JPEGs
  • From: Arthur VIGAN <email@hidden>
  • Date: Mon, 14 Mar 2005 22:27:12 +0100

I tried this:

    NSImageRep	*rep=[[currentImage representations] objectAtIndex:0];

ratio=[tempImage ratio];
[currentImage drawInRect:NSMakeRect(bounds.size.width/2.0- center.x*ratio,bounds.size.height/2.0-center.y*ratio,[rep pixelsWide]*ratio,[rep pixelsHigh]*ratio)
fromRect:NSMakeRect(0.0,0.0,[rep pixelsWide],[rep pixelsHigh])
operation:NSCompositeSourceOver
fraction:1.0];


Instead of:

    NSSize		size=[currentImage size];

ratio=[tempImage ratio];
[currentImage drawInRect:NSMakeRect(bounds.size.width/2.0- center.x*ratio,bounds.size.height/2.0- center.y*ratio,size.width*ratio,size.height*ratio)
fromRect:NSMakeRect(0.0,0.0,size.width,size.height)
operation:NSCompositeSourceOver
fraction:1.0];


But it doesn't work...

 -- Arthur;

At 11:23 AM -0800 3/14/05, Arthur VIGAN <email@hidden> wrote:
I have a problem with NSImage. When I open some JPEGs, and draw the
image in a view, the size is wrong: I can see the pixels, and the
resolution is really bad, even when I have high definition images. Do
you know where the problem comes from?

NSImage uses the photo's resolution to scale it to the proper size (or something close to it) on screen. So a 300x300 pixel image with a resolution of 300 dpi will get scaled down to roughly 1 inch by 1 inch on screen, which will probably only be 72 pixels by 72 pixels.

What you need to do is get the image's NSBitmapImageRep and call
[imageRep pixelsWide] and [imageRep pixelsHigh] to get the pixel
dimensions of the image. That should give you what you want.

Darrin
--
Darrin Cardani - email@hidden
President, Buena Software, Inc.
<http://www.buena.com/>
Video, Image and Audio Processing Development

_______________________________________________ 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
  • Prev by Date: Re: Training in Australia?
  • Next by Date: Re: Web Services
  • Previous by thread: Re: Problem of resolution with JPEGs
  • Next by thread: Re: Problem of resolution with JPEGs
  • Index(es):
    • Date
    • Thread