Click to See Complete Forum and Search --> : Convert from a series of array to collection of JPG files


fulltime
April 25th, 2006, 04:36 AM
Hi all,

I am a array of hex codes, a portion of which is shown below.



0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x04, 0x00, 0x04, 0x7F, 0xE0,
0x40, 0x04, 0x00, 0x48, 0x3F, 0xC0, 0x40, 0x04, 0x00, 0x40, 0x04, 0x00, 0x42, 0xFF, 0xF0, 0x00,
0x00, 0x01, 0x10, 0xFF, 0xE1, 0x10, 0x07, 0x87, 0x80, 0x48, 0xC2, 0x50, 0x12, 0x4F, 0xFE, 0x04,
0x03, 0x58, 0x44, 0x48, 0xC2, 0x04, 0x00, 0x00, 0x00, 0x01, 0x18, 0x0A, 0x07, 0xFC, 0x44, 0x44,
0x44, 0x7F, 0xC4, 0x44, 0x44, 0x47, 0xFC, 0x04, 0x0F, 0xFF, 0x04, 0x00, 0x40, 0x04, 0x00, 0x00,
0x00, 0x00, 0x04, 0x7F, 0xE0, 0x08, 0x3F, 0xCA, 0x4A, 0xA4, 0xAB, 0xFA, 0xA4, 0xAA, 0x4A, 0xBF,

each "0x00" represents one byte and every 24 bytes represent a character. My question is how can i take this array n generate its equivalent character into seperate JPG files? i.e take 1st 24bytes, convert, then save as a jpeg file, then take the 2nd 24bytes, convert n save as 2nd jpeg file and etc..

Can anyone help me pls?

Thks
FT :)

PS : i posted the above in an incorrect forum previously.. sorry..

GaboonViper
May 12th, 2006, 03:33 AM
Since your image data is only grayscale I really don't recommend using JPEG. JPEG only compresses grayscale to about 10-20% and even then there will be loss of data. With such little data available there is no point in compressing it anyway.

If you want to use JPEG anyway you're gonna need a library to write your jpegs or write the code yourself. In that case this FAQ may contain the answer. Item 15 has got the sourcecode of jpeg compression and depending on your operating system you can find a suitable library at one of the other items.
http://www.faqs.org/faqs/jpeg-faq/part2/

In your case I would recommend using BMP or GIF though.