Home > Archive > Compression > September 2006 > Rescue corrupted JPEG file...
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Rescue corrupted JPEG file...
|
|
|
| Hello,
I have a jpeg file. It is about 90% ok, but the missing 10% are not on the
end but on the begging of file, so this file has no header.
How can I open the file and see what does it contain?
I know this is a hard problem, but I saw an application that fixed avi file
with no header I also can fix a bitmap with no header, so maybe this is
possible to fix the jpeg file?
The file is big- about 2 MB and I guess the resolution is something between
700x700 to 5000x5000.
I think the biggest problem is to guess the width and height of the image.
In BMP files every line is ended with a special character, so it is easy to
get the original width and height with no header. Is the endline marked
somehow in jpegs?
If you don't know any program taht does it, but you know how it can be
written- please give my some hint and I will try to write it.
Regards,
Talthen
| |
| Matt Mahoney 2006-09-02, 6:55 pm |
|
talthen.z-serwera.o2@nospam.pl wrote:
> Hello,
> I have a jpeg file. It is about 90% ok, but the missing 10% are not on the
> end but on the begging of file, so this file has no header.
> How can I open the file and see what does it contain?
> I know this is a hard problem, but I saw an application that fixed avi file
> with no header I also can fix a bitmap with no header, so maybe this is
> possible to fix the jpeg file?
> The file is big- about 2 MB and I guess the resolution is something between
> 700x700 to 5000x5000.
> I think the biggest problem is to guess the width and height of the image.
> In BMP files every line is ended with a special character, so it is easy to
> get the original width and height with no header. Is the endline marked
> somehow in jpegs?
> If you don't know any program taht does it, but you know how it can be
> written- please give my some hint and I will try to write it.
>
> Regards,
> Talthen
If the Huffman tables are missing, there is not much hope. Maybe you
can try pasting the header from another jpeg produced by the same
application at the same quality setting and dimensions, and hope...
-- Matt Mahoney
| |
| Pete Fraser 2006-09-02, 6:55 pm |
| "Matt Mahoney" <matmahoney@yahoo.com> wrote in message
news:1157240026.514038.92400@e3g2000cwe.googlegroups.com...
>
> If the Huffman tables are missing, there is not much hope. Maybe you
> can try pasting the header from another jpeg produced by the same
> application at the same quality setting and dimensions, and hope...
Most JPEG encoders seem to use the Huffman tables suggested
in the standard. Guessing the DQT will be more difficult, but at
least you get a recognizable image even if the DQT is way off.
Life would be a bit easier with restart markers though...
They'd be quite easy to check for.
| |
|
| If your file contains restart markers ($FFD0.. $FFD7) then there is
hope. You will probably miss the Huffman and Quantisation tables. There
are standard Huffmann tables in use, depending on which lib compressed
your Jpeg. You could try these, and a standard Quantisation table to
see what is the outcome.
You'd have to guess the width and height of your image, yet you'll be
able to make that out from the tests. The width is always a multiple of
8.
Without restart markers, you don't know where the huffmann decoding
started, and it will be a lot more difficult since it can start on any
bit within the byte, and be anywhere in the current MCU, and anywhere
in the DC or AC coding sequence.
If your image has an optimized huffmann table then you're also in bad
shape.
Depending on how important the image is to you, you can always hire me
on an hourly basis to try and recover it. No guarantees given though. I
expect it will take a few hours to diagnose it and possibly recover it.
Nils Haeck
www.simdesign.nl
| |
|
| "Nils" <n.haeck@simdesign.nl> wrote:
> If your file contains restart markers ($FFD0.. $FFD7) then there is
> hope. You will probably miss the Huffman and Quantisation tables. There
> are standard Huffmann tables in use, depending on which lib compressed
> your Jpeg. You could try these, and a standard Quantisation table to
> see what is the outcome.
Well... the file doesn't have any 0xFFD0 nor 0xFFD7 words...
Thank you for your offer, but the image is worthless, so I don't want to pay
a cent to recover it. I am just curious if such thing can be done...
Regards,
Talthen
| |
| Nils Haeck 2006-09-03, 6:55 pm |
| > Well... the file doesn't have any 0xFFD0 nor 0xFFD7 words...
They don't have to be on word boundaries, can be on byte boundaries too.
Usually, when present, there are quite a lot of them, in ascending order and
then repeating, so.. FFD0 <data> FFD1 ... FFD7 then back to FFD0.
Actually restart markers aren't used often except in some camera software.
Nils
|
|
|
|
|