NSImage to JPEG file?
I have a background macOS daemon process (aka Foundation-based "command line tool") that needs to write out a JPEG file to local disk. The image resides in an NSImage object (or alternatively, an NSData of raw RGB image data). Short of resorting to something like libjpeg, what is the ObjC 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
Re: NSImage to JPEG file?
Use ImageIO. create a CGImageDestinationRef and add the CGImage to it. Vince > On Jan 14, 2019, at 12:17 PM, Carl Hoefs > wrote: > > I have a background macOS daemon process (aka Foundation-based "command line > tool") that needs to write out a JPEG file to local disk. The image resides > in an NSImage object (or alternatively, an NSData of raw RGB image data). > > Short of resorting to something like libjpeg, what is the ObjC 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/demarco%40apple.com > > This email sent to dema...@apple.com ___ 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
Re: NSImage to JPEG file?
Got it working! Thanks, that's the tip I needed. -Carl > On Jan 14, 2019, at 1:26 PM, Vince DeMarco wrote: > > Use ImageIO. > > create a CGImageDestinationRef and add the CGImage to it. > > Vince > > > >> On Jan 14, 2019, at 12:17 PM, Carl Hoefs >> wrote: >> >> I have a background macOS daemon process (aka Foundation-based "command line >> tool") that needs to write out a JPEG file to local disk. The image resides >> in an NSImage object (or alternatively, an NSData of raw RGB image data). >> >> Short of resorting to something like libjpeg, what is the ObjC 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/demarco%40apple.com >> >> This email sent to dema...@apple.com > ___ 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
Re: NSImage to JPEG file?
I will send you something. Sent from my iPhone > On Jan 14, 2019, at 2:17 PM, Carl Hoefs > wrote: > > I have a background macOS daemon process (aka Foundation-based "command line > tool") that needs to write out a JPEG file to local disk. The image resides > in an NSImage object (or alternatively, an NSData of raw RGB image data). > > Short of resorting to something like libjpeg, what is the ObjC 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/zav%40mac.com > > This email sent to z...@mac.com ___ 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