Extracting preview Image from PEF RAW file

Started by Beholder3, January 15, 2012, 04:57:39 PM

Previous topic - Next topic

BogdanH

Hi Ant,

If you have problems with showing PEF previews, mybe you should try the small utility provided here:
http://www.fastpictureviewer.com/forum/viewtopic.php?f=7&p=3119#p3119
..which should help you to identify if you have multiple WIC codecs installed for PEF file. If you get PEF decoder listed more than once, then you must remove some -because only one should be installed.

Bogdan

Beholder3

Quote from: BogdanH on January 16, 2012, 01:20:01 AM
After selecting desired PEF file(s) in GUI, you should use:
-b -JpgFromRaw -w %f.jpg
which will create jpg files.

Any idea why that command does not work on a DNG raw file in exiftoolGUI in the exiftool direct area?
Is DNG not a RAW file for it?

-b -BigImage -w %d%f.jpg and -b -previewImage -w %d%f.jpg work nicely on the same file.

By the way: What syntax would I need in the exiftool direct space for exiftool -b -ThumbnailImage MyPhoto.jpg>MyThumb.jpg?

Phil Harvey

The names of JpgFromRaw and PreviewImage are somewhat arbitrary.  The idea was that a PreviewImage was usually smaller than the full RAW image, but the JpgFromRaw was the full size.  However, due to the inconsistent way these images are stored, this isn't always the case now.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

BogdanH

Quote
exiftool -b -ThumbnailImage MyPhoto.jpg>MyThumb.jpg
-this command redirects output (output goes to disk instead on console window) and such commands doesn't work in ExifTool direct. That's because GUI allready redirects all ExifTool's output toward GUI.

Bogdan

Phil Harvey

Quote from: BogdanH on June 18, 2012, 01:26:00 AM
-this command redirects output (output goes to disk instead on console window) and such commands doesn't work in ExifTool direct. That's because GUI allready redirects all ExifTool's output toward GUI.

Yes, but you should be able to use the -o option instead.  Perhaps like this in the ExifToolGUI direct feature:

-thumbnailimage -b -o %d/%f_thumb.jpg

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

BogdanH

Hi Phil,
I have a problem with above command. I have tried it in console windows too:
exiftool -ThumbnailImage -b -o %f_thumb.jpg src.CR2
..but I get the same result as from ExifTool direct:
Error: Can't create JPEG files from other types
Am I using the command correctly? I am interested on this, because I hope I could create csv file by using -o option.

Bogdan

Phil Harvey

Ooopsie.  Sorry.  That should be -w, not -o:(

But unfortunately, -w creates one file for each input file, so it probably won't do what you want for the .csv output.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Beholder3

Quote from: Phil Harvey on June 17, 2012, 08:49:02 PM
The names of JpgFromRaw and PreviewImage are somewhat arbitrary.  The idea was that a PreviewImage was usually smaller than the full RAW image, but the JpgFromRaw was the full size.  However, due to the inconsistent way these images are stored, this isn't always the case now.

So you are telling me I should forget this command option since it is not gonna work on my DNG file?
(not an issue, since the others work, just curious)

Beholder3

Quote from: Phil Harvey on June 18, 2012, 12:18:51 PM
Ooopsie.  Sorry.  That should be -w, not -o:(
But unfortunately, -w creates one file for each input file, so it probably won't do what you want for the .csv output.

When I have a single DNG file selected in exiftoolGUI and run -ThumbnailImage -b -w %f_thumb.jpg pretty much nothing happens. No output file created.

Phil Harvey

Some DNG images just don't contain embedded JPEG's.  If yours is one of these, then the command won't work.

Sorry, I got hung up initially on the difference between PreviewImage and JpgFromRaw, which is sort of off topic (since using BigImage avoids this problem).

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

BogdanH

I'm somehow lost now.. I have original Pentax K-5.DNG file here.
This works:
exiftool -b -PreviewImage -w Thumb.jpg Pentax.DNG
-and extracts "medium size" preview (640x480). As far I can tell, this is defined in MakerNote section.

As Beholder3 said, this does nothing:
exiftool -b -ThumbnailImage -w Thumb.jpg Pentax.DNG
-I believe thumbnail (160x120) is defined in IFD0. Btw. this command works for CR2 files -so command used is correct.

Now, "full" preview seems to be defined in SubIFD1 section, but I can't access it neither with -PreviewImage or -JpgFromRaw (probably stupid, but I also tried with -SubIFD1:PreviewImage).
And now I have noticed you have mentiond -BigImage option, which again, does nothing for Pentax.DNG. I've looked here: http://www.exiftool.org/exiftool_pod.html but couldn't find any info about -BigImage (how/when to use).

Phil, am I interpreting your words right, when you say that previews inside DNG files are incosistent in regard of sections where they reside? And if that's true, is there a way to force pulling preview from particular (i.e. from SubIFD1) section?

Bogdan

Beholder3

#26
Guys, you are making my head spin.I have a DNG file here, straight out of a Pentax K-5 camera.

-b -BigImage -w %d%f.jpg works nicely, it extracts the 16 megapixel preview JPG.
-b -previewImage -w %d%f.jpg also works nicely it, extracts the 640 x 480 small thumbnail image.

On the same DNG file
-ThumbnailImage -b -w %f_thumb.jpg just does nothing (when executed via exiftoolGUI/exiftool direct).This does in no way fit to your comments. ???

PS:
The exiftoolGUI menu entry "export/import" / "extract preview from selected" gets me only the 640 x480 image from that DNG file.

PPS:
If that is of any interest: the metadata export into text file for that DNG contains the following three entries:

Quote---- Composite ----
Preview Image                   : (Binary data 1495796 bytes, use -b option to extract)
Preview Image                   : (Binary data 35502 bytes, use -b option to extract)
Big Image                       : (Binary data 1495796 bytes, use -b option to extract)

I created this .txt-file using GUI's menu option "Import/export" / "Export metadata into" / "TXT files".

PPS:
I just tried with 3 more DNG pictures of various age. The two abovementioned commands to extract the small and big previews always worked, while the third never does.

PPPS:
I just converted a Pentax K-5 created JPG into DNG via Lightroom 4.1 using the default DNG export.

The small preview also can be extracted using the abovementioned commands. It is 1024 x 678 pixels now though and I get the warning in exiftool "Warning: Bad MakerNotes offset for tag 0x406"
And ... using the BigImage command now gets me the exact same small 1024 x 678 pixel preview, not a fullsize preview as the ooC file did. Also the same warning.

Metadata textfile only shows this:

Quote---- Composite ----
Preview Image                   : (Binary data 45278 bytes, use -b option to extract)
Big Image                       : (Binary data 45278 bytes, use -b option to extract)






BogdanH

I must have one of the first (firmware) images from K-5 (taken from Imaging Resource). And for this file, composite tag BigImage isn't listed -but, as mentioned, preview image seems to be in SubIFD1 section.
I think that's what makes differences and causes consfusion here.

Bogdan

Beholder3

Strange. I wonder how Imagingressource created their RAWs.

You can take this here from DPReview:
http://movies.dpreview.com.s3.amazonaws.com/pentax_k5/IMGP3854.DNG.zip
It is also from firmware v1.0 (I used 1.13) and it already has both previews in it.

Quote
Preview Image                   : (Binary data 1301794 bytes, use -b option to extract)
Preview Image                   : (Binary data 40184 bytes, use -b option to extract)
Big Image                       : (Binary data 1301794 bytes, use -b option to extract)

Maybe you use this.

Phil Harvey

For images from my K-5 when I got it new:

> exiftool ../pics/PentaxK-5* | grep -E '(===|Binary|Software)'
======== ../pics/PentaxK-5.dng
Software                        : K-5 Ver 1.00
Preview Image                   : (Binary data 1155571 bytes, use -b option to extract)
Preview Image                   : (Binary data 35349 bytes, use -b option to extract)
Big Image                       : (Binary data 1155571 bytes, use -b option to extract)
======== ../pics/PentaxK-5.pef
Software                        : K-5 Ver 1.00
Jpg From Raw                    : (Binary data 1180544 bytes, use -b option to extract)
Preview Image                   : (Binary data 36179 bytes, use -b option to extract)
Thumbnail Image                 : (Binary data 7710 bytes, use -b option to extract)
Big Image                       : (Binary data 1180544 bytes, use -b option to extract)


This DNG has two PreviewImage's and doesn't contain a ThumbnailImage.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).