Image Alphachannel
Posted: Tue Dec 15, 2009 11:20 am
Dear board,
today I tried to figure out how to add an Alphachannel to a JPG-Image. Means: transforming from 24 to 32Bits, I suppose. I don't like API-Calls, if not needed.
This is the code-fragment which did the trick.
Is there a better way using non-api-calls (read: cross-plattform) to change depth of an image?? Maybe one little PB-function?
On Mac OS, the PB-routines draw alpha-channels on not-alphachannelled-jpeg-images, so I wondered why Windows doesn't.
Oh: using Windows XP.
EDIT: corrected the code. Should work now, as said.
today I tried to figure out how to add an Alphachannel to a JPG-Image. Means: transforming from 24 to 32Bits, I suppose. I don't like API-Calls, if not needed.
This is the code-fragment which did the trick.
Code: Select all
CreateImage(999,ImageWidth(ToImage),ImageHeight(ToImage),32)
StartDrawing(ImageOutput(999))
DrawAlphaImage(ImageID(ToImage), 0, 0, 255)
StopDrawing()
CopyImage(999,ToImage)
On Mac OS, the PB-routines draw alpha-channels on not-alphachannelled-jpeg-images, so I wondered why Windows doesn't.
Oh: using Windows XP.
EDIT: corrected the code. Should work now, as said.