Hi There I am looking for a push in right direction in relation to an assignment (ref below). I've got the read bit ok (i.e image into an array that is RGB no-alpha), but just a little unsure about what is next.
Write a Java program which reads an image in a popular format and saves the pixel data in a raw format. The program must be command line based with two arguments: the first argument is the image file in a popular format and the second argument specifies the file you save your raw image data with extension raw. The first line of the raw format file must be "grey image" if the image is grey or "colour image" if the image is colour. The second line must specify the dimension in two fields: the first field represents the width and the second field represents the height. An example metadata of the raw format is as follows:
colour image 256 256
The second part of the assignment requires you to develop your own Java image codec which can compress the raw format images of part A (above). The encoder can be very simple one however it must contain at least the following:
a) Transform coding stage b) Quantization stage c) Entropy coding stage
The compressed image must be saved to a file with extension jif. Any parameters you used for the compression must be saved except those parameters which don?t depend on a particular image. A corresponding decoder program must also be produced. =================== -Cheers Craig :-)
Well, in the second half of part "A", you'd open a file and write out the data. It sounds like they want a text format, based on the wording. So you could use a PrintWriter wrapping a FileWriter, write the two header lines, and then just write the pixel values for each row on successive lines.