Re: Newbie: Resizing an NSImage using it's NSImageRep
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