On Oct 9, 2014, at 9:08 PM, Carl Hoefs <newsli...@autonomy.caltech.edu> 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to