Jump to content
  • Advertisement

Archived

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

ms291052

BMP => PNG

This topic is 5307 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
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
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
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
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
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!