Re: NSImage to JPEG file?

2019-01-16 Thread Carl Hoefs
Thanks Wim and Gerd. It was the NSData tie-in I didn't know. (I was expecting NSImage to have innate export capabilities, but this works too.) -Carl > On Jan 16, 2019, at 7:56 AM, Wim Lewis wrote: > > On Tue, Jan 15, 2019 at 08:10:58PM -0700, Carl Hoefs wrote: >> Using NSBitmapImageRep, is it

Re: NSImage to JPEG file?

2019-01-16 Thread Jens Alfke
> On Jan 16, 2019, at 8:32 AM, Carl Hoefs > wrote: > > It was the NSData tie-in I didn't know. (I was expecting NSImage to have > innate export capabilities That would be poor API design. If it had -writeToFile, then it would also need -writeToStream:, -writeToFileHandle:, -writeToFileDescr

Re: NSImage to JPEG file?

2019-01-16 Thread Carl Hoefs
> On Jan 16, 2019, at 10:43 AM, Jens Alfke wrote: > >> On Jan 16, 2019, at 8:32 AM, Carl Hoefs > > wrote: >> >> It was the NSData tie-in I didn't know. (I was expecting NSImage to have >> innate export capabilities > > That would be poor API design. If

NSImage to JPEG file?

2019-01-16 Thread Greg Weston
>> That would be poor API design. If it had -writeToFile, then it would also >> need -writeToStream:, -writeToFileHandle:, -writeToFileDescriptor:, >> -writeToNSURLSessionDataDelegate:, etc. >> Providing the data itself means you can then use existing APIs on other >> classes to put the data an

Re: NSImage to JPEG file?

2019-01-16 Thread Jens Alfke
> On Jan 16, 2019, at 9:59 AM, Carl Hoefs > wrote: > > But all of that would come "for free" if NSImage inherited from NSData, no? Well, that wouldn’t make sense, because an NSImage isn’t a piece of data. It can have multiple data representations (JPEG, PNG, PDF…) and it might not have any