problem in colormap generator?

Blitz3D Forums/Blitz3D Programming/problem in colormap generator?

Guy Fawkes(Posted 2010) [#1]
Why won't this allow me to save my bmp image correctly?

everytime i try to open my colormap in paint it says its invalid for some reason

code:




Ross C(Posted 2010) [#2]
Why not just build an image and use the savebuffer command? It will save a bitmap, no hassle.


Guy Fawkes(Posted 2010) [#3]
i tried. and couldnt get it to work..

code:



its not saving right..


Ross C(Posted 2010) [#4]
At no point above, are you actually drawing the image you intially load. You have that line commented out. There is no need to write anything to a file. Just load the bitmap, then save it, via front buffer


Matty(Posted 2010) [#5]
Looking at your code there are a couple of issues:

1 - simply writing the rgb value of each pixel to a file is not going to generate a valid bitmap file. There is header information as well, although small, which needs to be included otherwise your paint program is not going to know how to interpret the file you write as a bitmap.

2 - actually there is only 1 issue, and that was the one mentioned above, but it was such a large issue that I thought it beared mentioning twice.

EDIT -

there actually is a second point - you are also reading the image beyond the size of the width/height. An image's x-y coordinates only go from "0" to "imagewidth() - 1" (and same for height) whereas you are also reading pixels at imagewidth() and imageheight(), which are outside the boundaries of the image. Although that doesn't change point 1 above.

EDIT 2 -

Also, once you get this working you may find using 'ground' bitmaps as a colour map lookup much nicer on the eye for for your colour map than simply using a fixed colour for each height range, and allowing them to transition from one to the next...I don't think that is very clear, although I'm sure someone else can explain it better.

EDIT 3 -

Actually I've made a bit of an error - I only saw you writing to a file first, and didn't see the savebuffer. Personally I think you are better off using the saveimage command and writing to an imagebuffer, but I might stop here before I make any more mistakes in my advice.


Guy Fawkes(Posted 2010) [#6]
Guys! FORGET about this thread. I found a SWEET FREE heightmap/texture generator!

http://www.saschawillems.de/?page_id=92