Inscape to bitmap

Started by
7 comments, last by billmason 16 years, 2 months ago
I know how to export to .png, but how do I get a bitmap?
Advertisement
Use a separate application to convert it. I don't believe Inkscape supports export to BMP.
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.
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.
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!
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.
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.
If you're already using D3DX, it has the ability.

Otherwise, you could grab an image loading library.
Got it, thanks

This topic is closed to new replies.

Advertisement