Convert (.hex?) file to viewable image -
i given text file , told converted image. text file looks this...
0000000 d8ff e0ff 1000 464a 4649 0100 0001 0100 0000010 0100 0000 e2ff a80c 4349 5f43 5250 464f 0000020 4c49 0045 0101 0000 980c 7061 6c70 1002 ... 000d320 8b4c 1b28 3bd4 0016 91e0 799e 34c1 4457 000d330 7113 ee4d cd73 4945 63db d9ff 000d33c
from googling, i'm pretty sure .hex file (though many of hex files have seen online had different formats, not certain).
when search 'converting hex image', results formatted mine dry.
is on type of file , how can convert view-able image?
thanks
this looks jpeg file, encoded in .hex
file.
i'm not used working hex
files, 7 first digit counting lines. i'll ignore them, i'm sure can find documentation on there role (if any!). real data bytes encoded in rest of each line.
sometime ago, wrote lightweight jpeg encoder. went source see if bytes can see in file rang bell:
the file starts d8ff
, , code wrote encoding jpeg, starts writing file header identifies jpeg , encodes information such size, starts writing bytes ffdb
(see this line, "soi" stands "start of file").
we have e0ff 1000 464a 4649 0100 0001
... , code writes: ffe0 0010 4a46 4946 0001 0100
(see line 127 , following), next bytes of standard jpeg file jfif header.
finally, 3 last bytes of file d9ff
, , jpec writes ffd9
end of file bytes.
obviously, file not written same endianness code (actually looks middle-endian, i've not seen before...), can see every packet of 2 bytes (4 hex characters) same when inverting order of these 2 bytes! jpeg-encoded image...
to read image, try:
- simply stripping 7 first digits of each line , writing remaining bytes binary file, if endianness of hex file fits 1 on machine, or
- stripping 7 first digits , reversing order of each packet of 2 bytes, , writing binary file, if endianness of machine fits 1 wrote jpec for!
hope helps!
Comments
Post a Comment