Re: Scaling an NSImage to have exact pixel dimensions
Re: Scaling an NSImage to have exact pixel dimensions
- Subject: Re: Scaling an NSImage to have exact pixel dimensions
- From: Ken Thomases <email@hidden>
- Date: Thu, 09 Oct 2014 22:05:40 -0500
On Oct 9, 2014, at 9:08 PM, Carl Hoefs <email@hidden> wrote:
> I need to scale an NSImage's dimensions to exactly 640x480 pixels before sending it remotely for processing.
> What is the correct way to do this?
Create an NSBitmapImageRep with the appropriate properties. Create an NSGraphicsContext from that bitmap image rep using +[NSGraphicsContext graphicsContextWithBitmapImageRep:]. Make that graphics context current. Draw the image. Flush and restore the graphics context. Get the data from the bitmap image rep in an image file format using -representationUsingType:properties: or (if you really want TIFF) -TIFFRepresentationUsingCompression:factor:.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden