Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: 32bit png image saving  (Read 2338 times)

0 Members and 1 Guest are viewing this topic.

fruitMaster

  • Newbie
  • *
  • Posts: 7
    • View Profile
32bit png image saving
« on: August 24, 2011, 11:19:24 am »
Ok, example code:

Code: [Select]
sf::Image img ;
img.Create( 256 , 256 ) ;
for( int x = 0 ; x < 256 ; ++x )
for( int y = 0 ; y < 256 ; ++y )
img.SetPixel( x , y , sf::Color( x , y , 255 , (256+x-y)%256 ) ) ;

img.SaveToFile( "C:/test.png" ) ;


This code produces a 24bpp png file, and not a 32bpp one. I've been looking at the code, and I don't see a way to specify this.
I'm even wondering if stb_image supports writing the alpha channel at all...

Any ideas?

Thanks in advance!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
32bit png image saving
« Reply #1 on: August 24, 2011, 01:33:18 pm »
Works for me with SFML 2.
Laurent Gomila - SFML developer

fruitMaster

  • Newbie
  • *
  • Posts: 7
    • View Profile
32bit png image saving
« Reply #2 on: August 24, 2011, 01:34:54 pm »
Damned, the bug is not in SFML, but in the bloody image viewer. Irfanview was reporting 24bpp and not showing the alpha channel at all.

Sorry for this stupid mistake.

 

anything