J
JVidal
Problem description: I have to convert a BufferedImage into a
monochrome PCX image file. So far I've tried using JIMI, until I
realize it didn't handle monochrome PCX. Since I couldn't find any Java
library supporting this format, I figured out I had to write an image
encoder myself.
I studied the JIMI code (the PCX encoding part), I found the PCX format
specs here: http://www.dcs.ed.ac.uk/home/mxr/gfx/2d/PCX.txt and here:
http://courses.ece.uiuc.edu/ece390/books/labmanual/graphics-pcx.html
anyway I'm still lost, as I'm a complete (and I mean complete!) newbie
when it comes to image manipulation - I still don't even have a precise
idea about what a ColorSpace or a ColorModel or a Raster or a palette
really are. Eg, I know I have to encode a monochrome palette in my PCX
header, but will the static array of bytes I extracted from another
monochrome PCX image do? (I guess not)
And what about encoding the image data? I've seen I could extract raw
data from the Java image with something like
BufferedImage img;
....
Raster raster = img.getData();
DataBuffer data = raster.getDataBuffer();
but is it really all the data I need to encode? Does it require some
sort of transformation before I RLE-encode this data into my PCX file?
And what if the original image comes in 16-bit, 256-bit, etc. color?
I'd really appreciate at least a few pointers or guidelines about all
these questions.
monochrome PCX image file. So far I've tried using JIMI, until I
realize it didn't handle monochrome PCX. Since I couldn't find any Java
library supporting this format, I figured out I had to write an image
encoder myself.
I studied the JIMI code (the PCX encoding part), I found the PCX format
specs here: http://www.dcs.ed.ac.uk/home/mxr/gfx/2d/PCX.txt and here:
http://courses.ece.uiuc.edu/ece390/books/labmanual/graphics-pcx.html
anyway I'm still lost, as I'm a complete (and I mean complete!) newbie
when it comes to image manipulation - I still don't even have a precise
idea about what a ColorSpace or a ColorModel or a Raster or a palette
really are. Eg, I know I have to encode a monochrome palette in my PCX
header, but will the static array of bytes I extracted from another
monochrome PCX image do? (I guess not)
And what about encoding the image data? I've seen I could extract raw
data from the Java image with something like
BufferedImage img;
....
Raster raster = img.getData();
DataBuffer data = raster.getDataBuffer();
but is it really all the data I need to encode? Does it require some
sort of transformation before I RLE-encode this data into my PCX file?
And what if the original image comes in 16-bit, 256-bit, etc. color?
I'd really appreciate at least a few pointers or guidelines about all
these questions.