Hi Phil,
A friend of mine is having a problem with some corrupt cr2 files... I've search everywhere I could to find a way to fix the problem but I'm running out of ressources and wondering if the files could even be repaired or if it is possible to extract a decent jpeg file form it.
The files can't be viewed in any imaging software, there is no visible previews but the size of the files are comparable to any other good files (22 mo). So is there a way?
I tried dcraw to extract a jpg but it doesn't seam to work.
These are important images for my friend and I hope you'll be able to provide some help.
Thanks!
p.s.: You can download an image following this link since the size is to big for the attachment: http://www.stephane-lariviere.com/XMG_1521.zip
The file you posted contains a 5472x3648 preview that may be extracted with this script: https://exiftool.org/forum/index.php/topic,4172.msg19805.html#msg19805
The file contains a CR2 image starting at offset 0x410000, so all of the metadata is there, and most of the raw image too probably.
- Phil
That is very good news!
Thank you for the fast reply.
I read the thread about "exiftool for dummies".
I tried to install exiftool to run the script but it causes my computer to crash badly... :/ I'm on windows 10 so I'm wondering if it could be a compatible problem?
I've install the .extract preview (but it seems to be for MAC)
All the files (exiftool and .extractpreview) are in the folder containing the raw images.
Do I need to download active Pearl in order to use exiftool or can I use the windows cmd or Powershell?
From everything I tried so far I only received error messages or that the command line isn't valid. etc...
Sorry to be a pain... this is all new to me and must admit a little overwhelming. lol
This is a lot of new informatiosn to absorbe to help a friend that isn't very much on the technical side.
Right. On Windows you need to install ActivePerl and download the full ExifTool distribution (the .tar.gz version). With the ExifTool "lib" directory from the full distribution in the same place as the "extract_preview" script, you would use this command:
perl c:\path\to\extract_preview\extract_preview c:\path\to\corrupted\images\
- Phil
All right... we're moving forward. ;-)
I've installed both exiftool and ActivePer and everything seems to work ok.
Now, when I tried to write the code you showed I got a message telling me that the path could not be found.
Here is my code line:
C:\Users\Stéphane Larivière\exiftool>perl\extract_preview\extract_preview c:\User\Stéphane Larivière\poz\corrupted
Note that I can't take away this part: C:\Users\Stéphane Larivière\exiftool>
My corrupted images are in a folder and the application files in a other.
Suggestions?
Thanks so much.
Looks like you forgot a space after perl on the command. Also because your path contains spaces, you need to put quotes around it. The C:\Users\Stéphane Larivière\exiftool> part is Windows showing you your current directory.
In short, I think if you change your text to the following, it should work:
perl \extract_preview\extract_preview "c:\User\Stéphane Larivière\poz\corrupted"
Thanks Hayo!
It actually worked better... at least I'm getting a new error message. lol
It now tells me this: Can't open perl script "\extract_preview\extract_preview": No such file or directory
Hum... I did install Activeperl and I can open the software.
I do have the extract_preview folder (with the files) in my folder as well as perl files.
There is for sure something I'm not doing right, but what?
Thanks again
Where did you put extract_preview? If in the same directory as exiftool, simply remove the \ in front of it.
Hi Hayo,
Yes extract_preview is in the exiftool folder. Removing the \ worked! :)
Now it processed but I received that message:
C:\Users\Stéphane Larivière\exiftool>perl extract_preview\extract_preview "c:\User\Stéphane Larivière\poz\corrupted\"
[extract_preview version 1.03]
===== c:\User\StÚphane LariviÞre\poz\corrupted\
Error opening file
----- Summary
1 files not processed due to errors
1 files processed
0 previews created:
Done.
Does it means I could not retreive anything from any file or is there still something to expect?
Thanks,
How many files did you have in the folder? And actually when I look at the output of the command, it looks like it actually didn't like your directory name as it contains accented letters (Windows and international characters are not a nice combination as Windows doesn't follow the standard of UTF8 encoding, but uses its own). Instead of C:\... try this ..\poz..\corrupted\
Also, to test if it works for you at all, run it on the test file you gave here earlier. Phil got a preview from that one so that should work for you too.
The folder contains 201 files. I will try to relocate the folder in order to link it to one without accents. I did try to run with a file but not the one a provided at first. I will try that too.
Thanks
YYYYYYYYYYeeeeeeeSSS! :)))
It seems to have worked!
Now... I have this at the end en the srting: ===== c:\poz\corrupted/XMG_1642.CR2
===== c:\poz\corrupted/_MG_2950.CR2
Found JPEG (160x120 pixels, 11388 bytes at offset 44460)
Found JPEG (5616x3744 pixels, 1251176 bytes at offset 55848)
--> saved 5616x3744 preview as c:\poz\corrupted/_MG_2950_preview.jpg
----- Summary
202 files processed
192 previews created:
11 160x120
180 5472x3648
1 5616x3744
Done.
But I can't see any previews... they seems to have been saved in the same folder but I don't see them?!?
Any clue?
Thanks soooo much!
What is the output of the command in cmd.exe window?:
dir c:\poz\corrupted\*.jpg
It should list all .jpg images in that directory.
- Phil
I created a folder called "rescued" to receive the extract previews.
In my last attemp I tried this line:
C:\exiftool>perl extract_preview\extract_preview "c:\poz\corrupted\" dir "c:\poz\rescued\*.jpg"
[extract_preview version 1.03]
===== c:\poz\corrupted" dir c:\poz\rescued\*.jpg
Error opening file
----- Summary
1 files not processed due to errors
1 files processed
0 previews created:
It does'nt process anything now. What would be my mistake here?
Thanks
I also tried this line that looked to work but again it failed...
perl extract_preview\extract_preview "c:\poz\corrupted" dir>c:\poz\rescued\*.jpg
It processed the images and told me previews already exists.... but where???
What is the exact output you get from Phil's dir command?
It actually tells me this:
C:\exiftool>dir c:\poz\corrupted\*.jpg
Le volume dans le lecteur C s'appelle OS
Le numéro de série du volume est 2484-EBDD
Répertoire de c:\poz\corrupted
Fichier introuvable
C:\exiftool>dir c:\poz\corrupted\XMG_1521.jpg
Le volume dans le lecteur C s'appelle OS
Le numéro de série du volume est 2484-EBDD
Répertoire de c:\poz\corrupted
Fichier introuvable
So I don't really know what else to answer.
Thanks
OK, so there are no "jpg" images in c:\poz\corrupted. This is odd. Could they be hidden somehow? I'm a bit at a loss. I don't think the "dir" command lists hidden files, but exiftool would find them. Here are a few things to try:
This command should list all recognized files in the directory, even if they are hidden: exiftool -filename c:\poz\corrupted
Or, there is a -o option for the extract_preview script that allows you to specify a directory for the output preview images:
exiftool -o OUTDIR c:\poz\corrupted
But make sure that the output directory (OUTDIR) exists before you run the command.
- Phil
Good... at last I wasn't turning crazy... lol
I tried the new line. Here is the result. Did I forgot something?
C:\exiftool>perl extract_preview\extract_preview "c:\poz\corrupted" exiftool -o OUTDIR c:\poz\rescued
[extract_preview version 1.03]
===== c:\poz\corrupted/XMG_1442.CR2
Found JPEG (160x120 pixels, 10614 bytes at offset 18102444)
Error renaming to OUTDIR/XMG_1442_preview.jpg
The folder rescued does exist.
I will try to aim to one folder outside the poz folder to see...
Any clue?
Thanks
Change "OUTDIR" to the name of your output directory. (ie. "c:\pos\previews") But make sure the directory exists before running the command.
- Phil
Good good good... it seems thought.
It ran the batch with that line: C:\exiftool>perl extract_preview\extract_preview "c:\poz\corrupted" exiftool -o c:\poz\rescued
at the end it tells:
===== c:\poz\corrupted/XMG_1641.CR2
Found JPEG (160x120 pixels, 12821 bytes at offset 17676460)
Found JPEG (5472x3648 pixels, 2220105 bytes at offset 17689284)
--> saved 5472x3648 preview as c:\poz\rescued/XMG_1641_preview.jpg
===== c:\poz\corrupted/XMG_1642.CR2
===== c:\poz\corrupted/XMG_1442.CR2.ep_tmp.jpg
Error opening file
===== exiftool
----- Summary
1 files not processed due to errors
202 files processed
190 previews created:
11 160x120
179 5472x3648
Done.
But when I check into the folder... nothing appears. Hum... ??? Magic? lol
OK. Same problem. :(
Also a new problem... there was a ".ep_tmp.jpg" file left around in the corrupted directory. You should delete this.
How do you check the folder? Try running "exiftool -filename c:\poz\rescued" and paste the output here.
Also, try re-running this command and paste its output too: perl extract_preview\extract_preview -o c:\poz\rescued "c:\poz\corrupted"
And one more thing to try. There is a very small chance that the backslashes are causing a problem, so try this:
perl extract_preview\extract_preview -o c:/poz/rescued "c:/poz/corrupted"
- Phil
Oooohh ok...
The first line didn't gave any output...
The second one ended with:
Found JPEG (160x120 pixels, 12821 bytes at offset 17676460)
Found JPEG (5472x3648 pixels, 2220105 bytes at offset 17689284)
===== c:\poz\corrupted/XMG_1642.CR2
===== exiftool
----- Summary
201 files processed
190 previews already existed
0 previews created:
Done.
And the last one:
Found JPEG (160x120 pixels, 12821 bytes at offset 17676460)
Found JPEG (5472x3648 pixels, 2220105 bytes at offset 17689284)
===== c:/poz/corrupted/XMG_1642.CR2
----- Summary
200 files processed
190 previews already existed
0 previews created:
Done.
Are we in the 5th dimension?
thanks
Very very weird.
Can you search your system for one of the files, say "XMG_1641_preview.jpg"?
Also, why do some files start with "X" and some with "_" ?
- Phil
I did a search it found nothing... :-\
The X in XMG_ comes from the original files rescued from the SD card.
Maybe I could try to rename the files to take away the X so it comes back to the normal spelling of the Canon files wich is MG_ ???
Oups sorry... it did found a file
It was placed in a folder called: VTRoot/Harddiskvolume2/poz/rescued
Quote from: stefanomen on December 14, 2015, 11:57:12 AM
It was placed in a folder called: Harddiskvolume2/poz/rescued
Odd. But at least you now know where they went! I'm guessing that this could be due to some funny way in which this hard disk partition is mounted.
- Phil
Thank you very much for your time and help both of you! :D
I know a little better now.
Happy Holidays!