Sure, I’m setting ofEnableAlphaBlending(); in the Draw-routine.
And everything is fine if I load a PNG-image.
But a JPEG (exported from Phostoshop) shows no transparency.
If I check img.bpp (after setting the image type to OF_IMAGE_COLOR_ALPHA) it says 32, so there should be an alpha-channel.
jpeg doesn’t support alpha channel i think, so when you set the type to COLOR_ALPHA, it converts the image to 32 bits and adds an alpha channel but there’s no information to generate the alpha so all of it is set to 255.
Right - the image on the disk jpeg is 24bit (RGB).
But after it has been loaded - and the imagetype changed to OF_IMAGE_COLOR_ALPHA, I thought I should be able to set the values in the fourth channel:
for(int i =3; i < img.height*img.width*4; i=i+4)
{
img.getPixels()[i] = 127;
}
img.update();
You are right, it looks like setImageType(OF_IMAGE_COLOR_ALPHA) should work, maybe it’s a bug. On a side note, this isn’t the same obviously, but if you want to draw the jpg transparently you can just do: