Re: NSBitmapImageRep from file
Re: NSBitmapImageRep from file
- Subject: Re: NSBitmapImageRep from file
- From: Marcel Weiher <email@hidden>
- Date: Mon, 7 Jan 2002 21:33:03 +0100
On Montag, Januar 7, 2002, at 12:10 Uhr, Tommaso Pecorella wrote:
My problem is that I _need_ a bitmap representation with that specs,
because I need to use the pixel colors to make a filtering effect. So
my code assume that the rgb values are in a given order and the alpha
channel isn't around.
You can't make that assumption. NSBitmapImageRep will read the data as
it is present in the file (if applicable), but definitely does not
guarantee a particular bit-depth, format, packing or even colorspace.
You could get a 2 bit per sample CMYK image with alpha.
If you need a defined representation, you will have to convert it
yourself. One way to do that is to draw into an NSImage (making sure to
specify a specific depth), get the corresponding bitmap and then convert
that. This will limit the number of formats your conversion code has to
deal with.
Moreover I need to scale the picture to a given size (that may be
different from the original one, even in h/w ratio).
You can take care of that by scaling before you draw the image.
Marcel
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.