How to extract high-res JPEG from Pentax (K10D) Adobe-DNG files?

Started by go4java, April 04, 2010, 11:36:15 AM

Previous topic - Next topic

go4java

Hi,
I'd like to know if EXIFTOOL supports the extraction of high-res JPEGs from Pentax raw files (Adobe DNG format)?
A syntax like "exiftool -b -previewimage test.dng > test.jpg" will extract a very low-res file (input = 16MB, output = 27kB only!).
The paramater "jpegfromraw" did not work for me.
Is it possible with EXIFTOOL and how?
Thanks and BR

Phil Harvey

If it exists, then exiftool can extract it.

Some Pentax DNG images contain two preview images.  To extract the first (default) preview, do this:

exiftool -previewimage -b FILE.dng > preview1.jpg

To extract the second preview, do this:

exiftool -copy1:previewimage -b FILE.dng > preview2.jpg

The output file will be zero bytes in size if the preview doesn't exist.

- 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 ($).

go4java

Quote from: Phil Harvey on April 04, 2010, 11:53:07 AM
exiftool -copy1:previewimage -b test.dng > test.jpg

Great, Phil! The above line worked for me!! Best regards

Beholder3

Hello,

is the situation the same with Pentax PEF files?

--> do they also contain more than one preview?
--> Can I use the same command (with test.pef instead of test.dng) ?

Phil Harvey

The K10D PEF has 3 embedded JPEG images: ThumbnailImage, PreviewImage and JpgFromRaw (in order of increasing size), compared with the camera-generated DNG which only has 2 (both named PreviewImage).

But I don't know what you are trying to do.   If it is helpful, the sample config file has an example user-defined tag called BigImage which extracts the largest available preview image from any format RAW file.

- 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 January 15, 2012, 05:15:30 PM
But I don't know what you are trying to do.   If it is helpful, the sample config file has an example user-defined tag called BigImage which extracts the largest available preview image from any format RAW file.

Thanks! I am actually exploring the file formats DNG vs. PEF and want to see which "quality" embedded pictures are in them (size, JPG compression etc.)

So I guess I need to add

# [advanced] select largest JPEG preview image BigImage => { Desire => { 0 => 'JpgFromRaw', 1 => 'PreviewImage', 2 => 'OtherImage', # (DNG and A100 ARW may be have 2 PreviewImage's) 3 => 'PreviewImage (1)', }, # ValueConv may also be a code reference # Inputs: 0) reference to list of values, 1) ExifTool object ValueConv => sub { my $val = shift; my ($image, $bigImage, $len, $bigLen); foreach $image (@$val) { next unless ref $image eq 'SCALAR'; # check for JPEG image (or "Binary data" if -b not used) next unless $$image =~ /^(\xff\xd8\xff|Binary data (\d+))/; $len = $2 || length $$image; # get image length # save largest image next if defined $bigLen and $bigLen >= $len; $bigLen = $len; $bigImage = $image; } return $bigImage; },


to my config file.

But then how do I "apply" the tag to a file "TEST.PEF" to write the embedded JPG to a file called "EXTRACT.JPG"?
Is it "exiftool -BigImage TEST.PEF > EXTRACT.JPG"?


Phil Harvey

Quote from: Beholder3 on January 15, 2012, 06:12:42 PM
Is it "exiftool -BigImage TEST.PEF > EXTRACT.JPG"?

Correct, except that you need to add the -b  option:

exiftool -b -BigImage TEST.PEF > EXTRACT.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 ($).