Jump to content
  • Advertisement
Sign in to follow this  
billmason

Inscape to bitmap

This topic is 3788 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

Advertisement
Quote:
Original post by Oluseyi
Use a separate application to convert it. I don't believe Inkscape supports export to BMP.

You're right, it doesn't; Inkscape only exports to PNG.

If it's a one-off I usually use another application like The GIMP to convert images. If you're converting lots it would be better to look for a dedicated convert program; they often have names like png2whatever, where whatever is the extension of the file you want.

May I ask though why you are converting to bitmap? As formats go its main benefit is that it's easy to write code to read it, but for nearly any practical use it's better to use a more compressed format (like PNG). You can get libraries for most (if not all) major game programming languages that can read file formats like PNG.

Share this post


Link to post
Share on other sites
I never though of using a png in my game. I use C++ and directx, is there a way to read .png with transparency? Thanks for the advice. I got inkscape to save the image as a bitmap, but it had a transparent background which isn't available in bitmaps so I'll just use GIMP.

THe way I got a bitmap was by modifying the extension on the path of the file. It was a quick fix and didn't work so I don't recommend it.

Share this post


Link to post
Share on other sites
Quote:
Original post by billmason
I never though of using a png in my game. I use C++ and directx, is there a way to read .png with transparency?

Almost certainly. I'm afraid my code is written using SDL and OpenGL so I'm not that knowledge about what's out there for DirectX. However if DirectX itself doesn't have a library function for converting PNG files to textures I'd be very surprised if there wasn't one already written out there that you can use. If you post a question in the DirectX forum then someone more expert than me should be able to help you.

You should be able to load in the transparency on PNGs with DirectX; I do so for my 2D game sprites in OpenGL, so I'm sure DirectX has an equivalent.

If you decide to use PNG, I recommend looking into an app called "pngcrush"; it's a handy tool that will compress your PNG files further making them smaller, sometimes significantly so. If you ever post your images on the internet (or games that use them) it'll save on download time and bandwidth for no loss of image quality. It's command line for the basic version, but there's also some handy app versions that put a GUI around pngcrush if you prefer.

Best of luck!

Share this post


Link to post
Share on other sites
Wow, thanks for the quick response. Your not watching the Super Bowl? :)

Yeah, I will look for a .png loader for directx. But knowing Microsoft, they won't want to have anything they didbn't create messing with their platform.

Share this post


Link to post
Share on other sites
Quote:
Original post by billmason
Wow, thanks for the quick response. Your not watching the Super Bowl? :)

Not my code of football, not my country [smile].

Quote:
Yeah, I will look for a .png loader for directx. But knowing Microsoft, they won't want to have anything they didbn't create messing with their platform.

From Googling around it looks like Direct3D at least already has the ability to load in PNG files. However even if there isn't something that does exactly what you want, chances are high that there's some code out there that can do it for you. Reading in image files is a very common task that everyone needs to do, and those kinds of things tend to get nifty open source libraries written for them. Most of the guts of my game engine is cobbled together from these; if someone else has already written and tested a library for you, why bother going through the pain of writing your own?

But I'd check first to see that DirectX itself doesn't already have the ability to load in a PNG file; it's a very common format now. If not, Google around for a library that can load in a PNG and deposit it in the memory format that you what, such as a DirectX texture that you immediately display on the screen. I know SDL and OpenGL has these, so DirectX should too.

Share this post


Link to post
Share on other sites
If you're already using D3DX, it has the ability.

Otherwise, you could grab an image loading library.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!