Re: Saving as JPEG
Re: Saving as JPEG
- Subject: Re: Saving as JPEG
- From: Marcel Weiher <email@hidden>
- Date: Sat, 18 Jan 2003 10:58:22 +0100
On Friday, January 17, 2003, at 10:17 Uhr, Marco Binder wrote:
NSCachedImageRep doesnt understand the representationOfType message
(as the docs will tell you). Thats why you called this function on the
NSBitmapImageRep class! So you have to make your image into an
NSBitmapImageRep obviously.
1) get the TIFF data of the image and use it to initialize a
NSBitmapImageRep
2) call representationOfType: on this NSBitmapImageRep and pass
NSJPEGFileType (and optionally a properties dictionary to set the
compression factor)
Hmm, I see this a lot, but it doesn't really make sense: you first
serialize the internal bitmap into a file format (which will go through
an NSBitmapImageRep somewhere along the way!), then you initialize a
new NSBitmapImageRep from the serialized representation and then you
serialize that into another representation.
Better:
while still focused on the NSImage, use [[NSBitmapImageRep alloc]
initWithFocusedViewRect: ... ];. That gets you the NSBitmapImageRep
without any intermediate steps, and you can party with that.
If you messed around with the CTM, you may want to unlockFocus and
re-lockFocusm, because -initWithFocusedViewRect: will take the CTM into
account.
Marcel
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.