Tai'lahr wrote:
However, they are unviewable in their current state, so you'll need to convert them using a program like Irfanview.
I hadn't noticed that, mainly because IrfanView is my default image viewer.
Hmm; it appears that the first four bytes are the size of the image data (not including the extra four bytes) in little-endian format. I'm guessing that's how they're stored internally, and someone forgot to strip the size when writing the images to disk.
If you have Unix tools (e.g. from Cygwin or MSys), you can strip the prefix bytes with.
Code:
tail -c +5 KIimage0001.jpg > KIimage0001.fixed.jpg
Or if you have Python, this will fix every .jpg file in the directory which hasn't already been fixed:
Code:
import os
for name in os.listdir('.'):
if not name.lower().endswith('.jpg'):
continue
f = open(name, 'rb')
s = f.read()
f.close()
if s[0:4] == '\xff\xd8\xff\xe0':
continue
if s[4:8] != '\xff\xd8\xff\xe0':
continue
f = open(name, 'wb')
f.write(s[4:])
f.close()