OS X 10.9 I need to scale an NSImage's dimensions to exactly 640x480 pixels before sending it remotely for processing. If I use NSImage's -setSize:(NSSize) method, it does set the size - temporarily. If I then try to serialize that NSImage into an NSData for transfer, that resize information seems to get lost:
NSImage *oldImage = [[NSImage alloc] initWithContentsOfFile:myFilename]; [oldImage setSize:NSMakeSize(640.0,480.0)]; NSLog(@"Old Image: %@",oldImage); NSData *dataObj = [oldImage TIFFRepresentationUsingCompression:NSTIFFCompressionLZW factor:1.0 ]; NSImage *newImage = [[NSImage alloc ] initWithData:dataObj]; NSLog(@"New Image: %@",newImage); * Old Image: <NSImage 0x618000267840 Size={640, 480} Reps=( "NSBitmapImageRep 0x6180002a4320 Size={1670, 1200} ColorSpace=(not yet loaded) BPS=8 BPP=(not yet loaded) Pixels=1670x1200 Alpha=NO Planar=NO Format=(not yet loaded) CurrentBacking=nil (faulting) CGImageSource=0x61800016b700" )> * New Image: <NSImage 0x618000073e00 Size={1670, 1200} Reps=( "NSBitmapImageRep 0x6180000b4700 Size={1670, 1200} ColorSpace=(not yet loaded) BPS=8 BPP=(not yet loaded) Pixels=1670x1200 Alpha=NO Planar=NO Format=(not yet loaded) CurrentBacking=nil (faulting) CGImageSource=0x61800017e240" )> What is the correct way to do this? -Carl _______________________________________________ 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