SFML community forums
Help => Graphics => Topic started by: treez on February 10, 2016, 12:28:16 am
-
I am currently trying to change the values of pixels of an Image.
When I change r g b values of an image and then I save it to a file it works propery.
Then I tried to change the alpha value also (I assing 253 or 245) and save the image. And my program does save it.
And then one weird thing happens when I open that changed image. The r g and b values are changed the way I changed them before, but alpha is ALWAYS 255 and I am wondering why if I saved the image.
As you might know, I am using setPixel function to change the pixels.
-
Do you save it in a format that supports transparency (e.g. PNG)?
-
I was using .bmp format. I checked if it supports transparency and Google says it does.
EDIT: well.. I ended up checking all the types of images that SFML supports and the format that works is indeed .png.
Still not sure why the others arent working, guess Google is a liar or SFML has some buggs.
-
We use stb_image to load images. It says that it doesn't support 1 bpp und RLE BMP files, nothing so far against transparent BMP though.
But again, BMP is a "bad" format, as such you should stick to PNG.
-
The standard Windows Bitmap format does not support any transparency unless you're using color keying (i.e. declare a specific color to be transparent). But that's not built into SFML/stb_image by default (when saving images).