Save Pixmap as BMP?
BlitzMax Forums/BlitzMax Beginners Area/Save Pixmap as BMP?
| ||
OK I must be pretty dumb here, but I can load a Pixmap from BMP, JPG or PNG, and save to JPG or PNG, *BUT* I can't find a command to save the PixMap as BMP. How do I do it please or do I need to convert it to a TImage first? Thanks :-) |
| ||
No idea, but all the code is there for loading a BMP file in the BMPLoader module. It wouldn't be massively difficult to write a SavePixmapBMP function based on the same code. What do you want to use BMP format for anyway?? |
| ||
Saving Images/Pixmap ? |
| ||
SavePixmapBMP() ? |
| ||
SavePixmapBMP() ? There's no such command. |
| ||
SavePixmapBMP() ? Have you got a native Bmax function called that? |
| ||
tonyg: thanks for the link. I need it because my game has some jpg backgrounds that I want to let the user set as the desktop wallpaper BUT the API command to do that only accepts jpgs! So I need to load in a JPG bitmap and save as BMP. I was *MOST* surprised to find there is no options to save as BMP, I know it's bloaty but it's a fundamental data type! |
| ||
Isnt the bmp format really really easy, like a raw uncompressed file dump? BMP is a pretty basic crappy format. |
| ||
your wiki friend is Bmx version in the link posted previously. |
| ||
yeah I'm not reinventing the wheel here, I'm gonna use that code ... *except that it doesn't work* I've just found out. Masks[0] gives Compile Error: Identifier 'masks' not found oh dear. |
| ||
BMP is indeed one of the most basic graphic formats that are there, although there are several sub-formats as well. You have the option of using RLE compression (Run-Length Encoding) which can shave off a little size, but it's nowhere near as complex as the compression used for JPEG or GIF. I wrote a PCX saver for PowerBASIC years ago, and didn't find it that difficult to implement the PCX RLE compression. Just looking at the GIF compression made my head explode, though. If you aren't too concerned about the compression thing, plain non-compressed BMP's are a very simple format, pretty much just a specified header with a raw data dump at the end. If you take a look at the BMP specifications at http://www.wotsit.org , you'll find it pretty straightforward. |
| ||
Grey Alien: yeah I'm not reinventing the wheel here, I'm gonna use that code ... *except that it doesn't work* I've just found out. Masks[0] gives Compile Error: Identifier 'masks' not found oh dear. because Masks is not part of TImage. Change all masks[] with pixmaps[] |
| ||
It's OK I got the answer a few days ago here: http://www.blitzbasic.com/Community/posts.php?topic=46036 Xlsior: Yeah I have loaded and saved BMP and PCX in DOS in C++ and assembly about 10 years ago. I just didn't want to code it again when I knew code for BMax must already be written. |
| ||
Why would one want to save an image as bloated ugly uncompressed bmp? |
| ||
I'm sure I said in one of the threads...anyway basically the API code to set the windows desktop wallpaper doesn't work with non-bmps (i.e. jpgs or pngs!) so I have to save a copy of the jpg as a bmp and set that as the wallpaper. See I had a good reason ;-) |
| ||
Take a look to this library: http://www.blitzcoder.com/cgi-bin/showcase/showcase_showentry.pl?id=snarty09252003024804&comments=no |