Chuft-Captain wrote:Thanks Spiff,
I'll have a look at that.
Incidentally, I discovered that the GIMP also exports "C" code .h and .c files complete with accessor functions... If I had a C compiler on my system, that would be the way to go!
For my needs your PNM method will probably do the job, just not quite as easily.
Cheers
CC
CC,
let me add that many image formats are organized very similarly. What differs are the image headers and often there is compression and the possibility for an alpha channel. PNG format is a close relative to PNM, except that PNG supports e.g. also alpha and various degrees of compression. PNG also exists entirely uncompressed like PNM format.
As an illustration of how versatile my F-TexTools are
, you can use my tool 'png2bin' to just print out from a PNG texture the sequence of pixels you are interested in. That's what bin format is all about
> png2bin < test.png > test.bin
Then, in test.bin, you have all the pixels you want, except they are in
hex format (00..FF). That is trivial to account for. Right?
Moreover, in these image files, one works in the "image frame" rather than the "XY frame".
For each texture line the 1 byte pixel values are listed successively for all columns of that line and then the next line follows etc. Moreover you have to run through the various color values, like so e.g. in line 1
RGBRGBRGBRGBRGB.......RGB
each of R,G,B is a number between 0 and 255 or in hex 00 and FF.
If you have an alpha channel as well then the only change would be
RGBARGBARGBA....RGBA
hence alpha is treated as a 4th color.
The transformation to XY coordinates is again a very elementary (linear) relation...
[2 equations, 2 unknowns
]
Fridger