Corrupt jpegs, thumbnail extracted...

Ask for help and post your question on how to use XnView Classic.

Moderators: XnTriq, helmut, xnview

conkers

Corrupt jpegs, thumbnail extracted...

Post by conkers »

hi!

I was wondering if anyone can help me?

Recently we had a hard drive crash and we lost everything, and no, we didn't back up :( - Lesson learnt.

Photos are the only thing I'm after. The main image is corrupt and I am in the process of extracting the thumbnails.

So....

Is there anyway I can make the thumbnail image bigger, without the image becoming blurred?

Or is there a way to rebuild from a thumbnail?

Many thanks in advance for any replys and I will put my hand up to not knowing alot about this at all! Just desperate to have pictures of my daughter.
User avatar
XnTriq
Moderator & Librarian
Posts: 6402
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: HELP corrupt jpegs, thumbnail extracted...

Post by XnTriq »

Hello conkers :-)

Unfortunately I've got more questions than answers for you at this point:
  1. When you say “the main image” you mean the original full-resolution photos, correct?
  2. Where are you “extracting the thumbnails” from? From XnView's cache (XnView.db)?
  3. What kind of attempts have been made to recover the data from the crashed hard drive?
  4. Were these photos scanned in or were they transferred from the flash memory card of a digital camera?
conkers wrote:Is there anyway I can make the thumbnail image bigger, without the image becoming blurred?

Or is there a way to rebuild from a thumbnail?
Well, there's software specialized in upscaling small images, but these programs can't restore lost detail:
Related topics:
Last edited by XnTriq on Thu Aug 28, 2008 2:00 am, edited 1 time in total.
conkers

Post by conkers »

Many thanks for replying

In answer for your questions...

1. Yes I do mean the full resolution photos
2. err... as I said I'm very new to all this... I have been using Jpeg Snoop to extract the thumbnails..?? Is that right?!
3. We have/had 2 hard drives. They are/were Raid 0. Data was banded across both drives. We had a head crash and the blue screen of death. We sent off the drives to a data recovery agency (2 actually to get a second opinion) The drive which had the head crash is unreadable. What we have back is photos that are corrupt - grey banding, colour distortion etc. BUT we do have SOME phtos with thumbnails and also alot of photos which we can't even open at all.
4. Transferred from a digital camera, I have also attempted to rescue photos from the memory stick, and I have got a few off it, but it was written over time and time again.

I think that answers them!
Once again many thanks in replying.
I'm completly new to all this, I'm just a desperate mum that wants to find anyway of having a some photos of my daughter. So I'm sorry I don't know what I'm talking about!!
User avatar
XnTriq
Moderator & Librarian
Posts: 6402
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Post by XnTriq »

Sorry for the delay.
conkers wrote:I'm completly new to all this, I'm just a desperate mum that wants to find anyway of having a some photos of my daughter. So I'm sorry I don't know what I'm talking about!!
Why so modest? Either you're a fast learner or you're not such a newbie as you claim to be.
conkers wrote:3. We have/had 2 hard drives. They are/were Raid 0. Data was banded across both drives. We had a head crash and the blue screen of death. We sent off the drives to a data recovery agency (2 actually to get a second opinion) The drive which had the head crash is unreadable. What we have back is photos that are corrupt - grey banding, colour distortion etc. BUT we do have SOME phtos with thumbnails and also alot of photos which we can't even open at all.
4. Transferred from a digital camera, I have also attempted to rescue photos from the memory stick, and I have got a few off it, but it was written over time and time again.
Obviously, you've done your homework. 8)
Now that all of my questions have been answered perfectly, we know where we stand.
conkers wrote:2. err... as I said I'm very new to all this... I have been using Jpeg Snoop to extract the thumbnails..?? Is that right?!
JPEGsnoop is great for analysing or even fixing corrupt photos, but “manually” pulling out embedded previews from dozens of JPEGs would be a tedious job.

I know of at least two free programs which enable you to extract the EXIF thumbnails in batch mode: Too bad that both jHead and ExifTool are command line driven, meaning they do not come with a GUI (graphical user interface) front end out of the box.
jHead Usage documentation » [url=http://www.sentex.net/~mwandel/jhead/usage.html]Thumbnail manipulation options[/url] wrote:-st <name>

Save the built in thumbnail from Jpegs that came from a digital camera. The thumbnail lives inside the Exif header, and is a very low-res JPEG image. Note that making any changes to a photo, except for with some programs, generally wipes out the Exif header and with it the thumbnail.
I implemented this option because I kept getting asked about having such an option. I don't consider the built in thumbnails to be all that useful - too low res. However, now you can see for yourself. I always generate my thumbnails using ImageMagick (see end of this page).
Like the '-te' option, this feature has the 'relative path' option for specifying the thumbnail name. Whenever the <name> contains the characters '&i', jhead will substitute the original filename for this name. This allows creating a 'relative name' when doing a whole batch of files. For example, the incantation:
  • jhead -st "thumbnails\&i" *.jpg
would create a thumbnail for each .jpg file in the thumbnails directory by the same name, (provided that the thumbnails directory exists, of course). Both Win32 and most UNIX shells treat the '&' character in a special way, so you have to put quotes around that command line option for the '&' to even be passed to the program.

If a '-' is specified for the output file, the thumbnail is sent to stdout. (UNIX build only)
ExifTool Application Documentation » ([url=http://www.sno.phy.queensu.ca/~phil/exiftool/exiftool_pod.html#reading_examples]Reading Examples[/url]) wrote: exiftool -b -ThumbnailImage image.jpg > thumbnail.jpg
  • Save thumbnail image from image.jpg to a file called thumbnail.jpg.
Maybe fellow board member oops66 will help us out here:
  1. Does PhotoME support extraction of EXIF thumbs?
  2. Would you recommend ExifToolGUI for Windows?
Last edited by XnTriq on Thu Aug 28, 2008 2:00 am, edited 1 time in total.
Conkers¹

Post by Conkers¹ »

Many thanks once again for replying, it is much appreciated.

I am a complete novice! but it is amazing what you can do when you are determined!

Just giving you an example of our photos and the thumbnail view

Image Image

and one for just being a proud mum!!

Image
User avatar
XnTriq
Moderator & Librarian
Posts: 6402
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Post by XnTriq »

Conkers wrote:I am a complete novice! but it is amazing what you can do when you are determined!
It's your inner geek that's breaking through. ;-)
  • Image
:D No wonder you're so determined to get those photos back.

A closer look at DSC01114.jpg reveals that the picture was taken at the maximum resolution of your Sony CyberShot DSC-V1: 2592×1944 (5 megapixels in Fine JPEG mode).
But the actual dimensions of the image you posted are only 800×600 pixels. :?

There's another thing leading me to believe you might have uploaded a downsized copy of the corrupted JPEG to your Photobucket account: Usually those bandings have sharp edges. The blurry edges in your image, however, show signs typical for certain resampling methods.

If an already damaged file is reprocessed, the mangled bits & bytes are mixed up even more. Therefor it becomes significantly harder – if not impossible – to “rearrange” them to their proper order.

Do you have a full-res version of DSC01114.jpg?

FYI: As a registered member of this forum you wouldn't have to post your photos publicly. You'd be able to send me links via private messaging instead. Members also receive a notification e-mail whenever there's a new reply in a topic they're interested in.
User avatar
oops66
XnThusiast
Posts: 2005
Joined: Tue Jul 17, 2007 1:17 am
Location: France

ExifTool can recursively extract the thumbnails

Post by oops66 »

---> Conkers
XnTriq wrote:.......
ExifTool Application Documentation » [url=http://www.sno.phy.queensu.ca/~phil/exiftool/exiftool_pod.html#reading_examples]Reading Examples[/url] wrote: exiftool -b -ThumbnailImage image.jpg > thumbnail.jpg
  • Save thumbnail image from image.jpg to a file called thumbnail.jpg.
Maybe fellow board member oops66 will help us out here:
  1. Does PhotoME support extraction of EXIF thumbs?
  2. Would you recommend ExifToolGUI for Windows?
Hello,
Just for information, after your crash disk, to try to extract the embedded thumbnails from your corrupted jpg files (of course the quality 'll be poor), and if you want to have exiftool recursively scan all jpg files and jpg into subdirectories then:
To extract all thumbnails recursively into thumbnails folder try to do:
if into a linux console (or batch .sh file) ~like:

Code: Select all

exiftool -b -m -ThumbnailImage -w thumbnails/%d%f_thumbnail.JPG -ext jpg -r .
if into dos prompt / windows ( or a batch .bat file) ~like:

Code: Select all

exiftool -b -m -ThumbnailImage -w thumbnails/%%d%%f_thumbnail.JPG -ext jpg -r .
Save thumbnails images from images####.jpg to files called images####_thumbnail.jpg.
PS: Make a test before, into a test-folder with few jpg files.

But I think, under Windows, ExiftoolGUI can do that easily ? but never tested.
PhotoMe : I do not know .
---------------------------------------
It is also possible to extract thumbnails from XnView.db (the SQLite Blobs), but I do not know any freeware to do that !
Pierre do you have a way to do that ???
XnViewMP Linux X64 - Debian - X64
User avatar
helmut
Posts: 8705
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Re: ExifTool can recursively extract the thumbnails

Post by helmut »

oops66 wrote:... It is also possible to extract thumbnails from XnView.db (the SQLite Blobs), but I do not know any freeware to do that !
Pierre do you have a way to do that ???
To view the thumbnails stored in the cache you simply type in "cache:" in the address field of the XnView browser. XnView will then display all cached thumbnails. Though I have no idea how you can export the thumbnails into a new image. Pierre?
User avatar
oops66
XnThusiast
Posts: 2005
Joined: Tue Jul 17, 2007 1:17 am
Location: France

Ability to extract thumbnails from XnView.db

Post by oops66 »

Right Helmut, it's the beginning of a new possibility (a new XnView function) to have the ability to extract thumbnails from XnView.db file (because in case of corrupted jpg files, it's better than nothings).
But above, more basically, I mean a way to extract blobs from any data base, not only Xnview.db.
So Pierre ???
XnViewMP Linux X64 - Debian - X64
User avatar
xnview
Author of XnView
Posts: 45062
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Ability to extract thumbnails from XnView.db

Post by xnview »

oops66 wrote:So Pierre ???
Don't know, perhaps with SqliteBrowser
Pierre.
User avatar
oops66
XnThusiast
Posts: 2005
Joined: Tue Jul 17, 2007 1:17 am
Location: France

Re: Ability to extract thumbnails from XnView.db

Post by oops66 »

xnview wrote:Don't know, perhaps with SqliteBrowser
No, I have it (v1.3) but it doesn't manage the blob.
So we waiting for this new xnview function -LOL :D !
XnViewMP Linux X64 - Debian - X64
User avatar
XnTriq
Moderator & Librarian
Posts: 6402
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Post by XnTriq »

Hi Conkers,

thanks for your patience.
It took some time for me to get all the facts together.

Bad news: I wasn't able to fix your photo. :(
Good news: I'm no expert, just an XnTriq. ;-)
In other words: There's still plenty of hope :!:

I consider this posting a preliminary report.

After you had sent me a full-size version of the photo I began replacing the header as explained by Calvin Hass.
ImpulseAdventure ([url=http://www.impulseadventure.com/photo/fix-corrupt-jpeg-photo.html]Fix your Corrupted JPEG Photos![/url] » Comments » 2008-04-18) wrote:As a first method of trying to fix your corrupted images, it's always worth a shot and is easy to do.

In advance of this feature, here's what you can try doing:
  1. Open up the damaged photo (corrupted header) in the hex editor
  2. Open up another photo taken with the same camera, and with the same orientation in another window of the hex editor
  3. Identify the start of the real (not thumbnail) scan data -- the easiest way to do this is open up the damaged file in JPEGsnoop and look for the OFFSET line under the heading Marker: SOS. Note down this hex number (eg. 0x00002C5F).
  4. Repeat the same process with the good photo (eg. 0x000030DB)
  5. Now, in a copy of your corrupted photo file, use the hex editor to delete everything from 0x00000000 to 1 less than the offset noted in step 3 (ie. 0x00002C5E).
  6. In the good version of the photo, copy everything from 0x00000000 to 1 less than the offset noted in step 4 (ie. 0x000030DA).
  7. Back in the copy of your corrupted photo file, use the hex editor and paste (insert) what you copied, right at the start of the file (position 0x00000000). Save as a different file name.
When you reopen the modified version of the damaged file, you should see that the thumbnail now represents the "good file" you were working with. If you only had a header corruption, then the damaged image may now be brought back to life!
In case you'd like to follow along with the steps outlined in the tutorial, I've compiled a list of freeware hex editors (as well as text editors with hex editing capabilities):Please don't forget to always work with backup copies of your files when using these programs (even if you don't plan to make changes).

For this method you'll also need “another photo taken with the same camera, and with the same orientation”. I downloaded a few from dpreview.com and dcresource.com.

Having tried all kinds of combinations (incl. bare headers w/o any metadata) unsuccessfully, I decided to examine the image once more with JPEGsnoop v1.2.0 (22/Jan/2008) & v1.2.1 β3 (09/Apr/2008). This time I enabled the Detailed Scan Decode option (Options » Scan Segment » Detailed Decode...) before hitting Ctrl+R (File » Reprocess File).

Code: Select all

*** Decoding SCAN Data ***
  OFFSET: 0x00001726
  Scan Decode Mode: Full IDCT (AC + DC)

[...]

*** ERROR: @ 0x0002EE09.4, num_coeffs>64 [66]
*** ERROR: Bad scan data in MCU(120,24): Lum DC CSS(1,0) @ Offset 0x0002EE0A.2
           MCU located at pixel=(1928,192)
*** ERROR: @ 0x000EEE10.5, num_coeffs>64 [65]
*** ERROR: Bad scan data in MCU(95,130): Lum DC CSS(1,0) @ Offset 0x000EEE11.2
           MCU located at pixel=(1528,1040)
*** ERROR: @ 0x0016EE00.1, num_coeffs>64 [68]
*** ERROR: Bad scan data in MCU(89,195): Lum DC CSS(1,0) @ Offset 0x0016EE01.0
           MCU located at pixel=(1432,1560)
*** ERROR: @ 0x001AEE07.3, num_coeffs>64 [66]
*** ERROR: Bad scan data in MCU(29,222): Lum DC CSS(1,0) @ Offset 0x001AEE08.2
           MCU located at pixel=(472,1776)
This more verbose output indicates scan errors in the bitstream of the JPEG rather than corruption of its header. :-|
At first I though we were screwed. By then I had already tested a bunch of programs to no avail:But a brief consultation with almighty Google reminded me that Calvin had repaired photos which had very similar errors.
ImpulseAdventure ([url=http://www.impulseadventure.com/photo/jpeg-snoop-uses.html]JPEGsnoop - Interesting Uses[/url] » Comments » 2007-11-03) wrote:I'm pleased to report that I managed to recover these images almost perfectly! Your photos were great examples of heavy data corruption, which in turn helped me refine the fix methodology. What I found interesting, however, is that the corruption appeared to have some periodicity within the image, but not so much within the file stream.
ImpulseAdventure ([url=http://www.impulseadventure.com/photo/fix-corrupt-jpeg-photo.html]Fix Corrupt JPEG Photos![/url]) wrote:Fixing Corrupt Photos

During the development of JPEGsnoop (a JPEG analysis tool), I began to question whether it was at all possible to fix images that have had errors in the scan segment (JFIF SOS) bitstream. After significant analysis and tool development, I am happy to report that I am now able to correct many of these photos!

Unique Correction Technique!

While there are dozens of software utilities available on the web that advertise that they fix or recover corrupt JPEGs, I am not yet aware of any that actually correct scan bitstream errors (as shown in the samples below). In nearly all cases, these programs will recover the files from deletion (stitching file clusters together) but you may still be left with a damaged JPEG image!

I believe my technique to be unique and hence the reason I decided to post this page and share my services. Photos can often be fixed with virtually no degradation to the original image!
Conkers
Posts: 1
Joined: Sat Aug 23, 2008 10:58 am

Post by Conkers »

wow! thank you all so much for your help and interest.
I don't know what to say....
XnTriq wrote:At first I though we were screwed. By then I had already tested a bunch of programs to no avail:
I have also looked at these, and probably alot more! None of them worked, so I gave up with them and concentrated on the thumbnail.

I'm in the process of looking at jHead at the moment. Can only seem to extract the first thumbnail and the rest says "image contains no thumbnail". mmm, will keep playing with it and will let you know!
BloodyRain2k
Posts: 24
Joined: Wed Oct 31, 2012 3:37 pm

Re: Corrupt jpegs, thumbnail extracted...

Post by BloodyRain2k »

I know I'm reviving the dead here but if I'd make a new topic about this I'd mostlikely get refered to here anyways.

I'd also like to retrieve some thumbs from my DB as they lost the connection to their originals through moving or other means.
If I could get the thumbs out I could fire them against a similarity software and see if and where I got the originals now.
I already tried cache: but that just showed them to me without letting me save them in any way so it's no help. Maybe I just missed something, dunno.

Another thing I'd also like to know is how the thumb data is composed, I already managed to get an images data out of the database for an external tool that shall fix some things like lost connections in the cache.
The problem is that the data is not useful, there's some additional data added before or mixed in, either way was I'm not able to determinate the beginning of the actual thumb data.

The only thing I know so far is that the data blob is longer than what the Size field states, so it's probably related to how to find the actual thumb in there, but it's not as easy as thumb = blob starting at (blob_lenght - Size).
The additional data seems to be longer than the difference between Size and the blob's size.
Debian 12 x64 - XnViewMP 1.6.2 x64
Dragan
Posts: 1
Joined: Sun Aug 25, 2013 6:38 pm

Re: Corrupt jpegs, thumbnail extracted...

Post by Dragan »

Dear Conker,
looking for solution of my damaged JPEG, I am found out that You had a same problem 5 years ago. I will be very grateful if you answer me were you able to recover your photos and how.
Thank you in advance.
Best regards