Archived

This topic is now archived and is closed to further replies.

ms291052

BMP => PNG

Recommended Posts

ms291052    223
I was wondering if there was anyway to use DirectX to take two input files, the first being a bitmap, and the second being a grayscale bitmap to be used as the opacity map, combine the two, and output a png or some other format that supports alpha. Any thoughts on how to do this?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Well, you could load the bitmap into a D3D texture, modulate it''s alpha with your opacity map, and save it as a png (though you''d need to find or write code to do that).

Share this post


Link to post
Share on other sites
SiCrane    11839
If you don''t really need this functionality in your game proper, it would probably just be easier to use an existing tool for this kind of thing. For example, in Gimp, you''d just load the first bitmap, add a layer mask, paste the second bitmap in the mask, flatten and save.

Share this post


Link to post
Share on other sites
ms291052    223
I couldn''t figure out how to do it with the D3D Texture thing... but I haven''t ever heard of FreeImage, where can I get that. I''d rather like to be able to do this manually as it''s a function that may be required in oen of my projects. Maybe I just haven''t done my homework but I haven''t ever heard of gimp either. Is there any place I could get that too?

Share this post


Link to post
Share on other sites
DrunkenHyena    805
quote:
Original post by ms291052
I couldn''t figure out how to do it with the D3D Texture thing.

Load your base image, then in the File menu select "Open onto Alpha Channel of this image", choose your image that you want to use as the alpha channel, and they will be combined.



Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites
Coleco    164
FreeImage:

http://freeimage.sourceforge.net/


Gimp:

http://www.gimp.org/


First thing you need to get familiar with is Google. ;-)

http://google.com


cb

Share this post


Link to post
Share on other sites
gwihlidal    1004
Well you could load the bmp normal as an RGB with 3 channels, resize the memory for the image to support an extra value per pixel making it an RGBA with 4 channels. And then go through the greyscale image data and put the pixel in the 4th channel for each pixel. Then you could save it as an RGBA png

Hope that helps,

~Graham

----
while (your_engine >= my_engine)
my_engine++;

Share this post


Link to post
Share on other sites