• 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: Newbie: Resizing an NSImage using it's NSImageRep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie: Resizing an NSImage using it's NSImageRep


  • Subject: Re: Newbie: Resizing an NSImage using it's NSImageRep
  • From: Heinrich Giesen <email@hidden>
  • Date: Tue, 3 May 2005 17:41:02 +0200


On 03.05.2005, at 16:23, Jeff Brown wrote:

I've created an NSImage from a .jpg file. I then look
at it's size.height and its NSImageRep's pixelHeight
to calculate it's resolution.

You can do this with:
- (float) dpiX { return theRep pixelsWide]/[theRep size].width; }
- (float) dpiY { return theRep pixelsHigh]/[theRep size].height; }

I reduce the pixelHeight .... so that I get a resolution of 300

You have a 50 percent chance to do the right change. You lost.
You cannot change the number of pixels because they describe the
physical structure of the imageRep. On the other hand the imageRep size
is a virtual value that decribes the appearence when depicted.

Change the size of the image and tell it: -<x-tad-smaller>setScalesWhenResized:YES</x-tad-smaller>

Heinrich

--
Heinrich Giesen

email: 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

  • Prev by Date: Re: Preferences file in Tiger
  • Next by Date: Re: Spotlight -- Metadata importer vs file package containing rtfd files
  • Previous by thread: Re: Newbie: Resizing an NSImage using it's NSImageRep
  • Next by thread: Documentation update
  • Index(es):
    • Date
    • Thread