Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Graphics
»
getting pixels from sf::Image
Print
Pages: [
1
]
Author
Topic: getting pixels from sf::Image (Read 1962 times)
0 Members and 1 Guest are viewing this topic.
treez
Newbie
Posts: 9
getting pixels from sf::Image
«
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.
«
Last Edit: February 10, 2016, 12:31:07 am by treez
»
Logged
eXpl0it3r
SFML Team
Hero Member
Posts: 11028
Re: getting pixels from sf::Image
«
Reply #1 on:
February 10, 2016, 01:57:03 am »
Do you save it in a format that supports transparency (e.g. PNG)?
Logged
Official FAQ:
https://www.sfml-dev.org/faq.php
Official Discord Server:
https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog:
https://duerrenberger.dev/blog/
treez
Newbie
Posts: 9
Re: getting pixels from sf::Image
«
Reply #2 on:
February 10, 2016, 03:08:15 pm »
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.
«
Last Edit: February 10, 2016, 10:09:18 pm by treez
»
Logged
eXpl0it3r
SFML Team
Hero Member
Posts: 11028
getting pixels from sf::Image
«
Reply #3 on:
February 11, 2016, 02:56:50 am »
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.
Logged
Official FAQ:
https://www.sfml-dev.org/faq.php
Official Discord Server:
https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog:
https://duerrenberger.dev/blog/
Mario
SFML Team
Hero Member
Posts: 879
Re: getting pixels from sf::Image
«
Reply #4 on:
February 11, 2016, 04:02:17 pm »
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).
Logged
Print
Pages: [
1
]
SFML community forums
»
Help
»
Graphics
»
getting pixels from sf::Image
anything