ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: go4java on April 04, 2010, 11:36:15 AM

Title: How to extract high-res JPEG from Pentax (K10D) Adobe-DNG files?
Post by: go4java on April 04, 2010, 11:36:15 AM
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
Title: Re: How to extract high-res JPEG from Pentax (K10D) Adobe-DNG files?
Post by: Phil Harvey on April 04, 2010, 11:53:07 AM
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
Title: Re: How to extract high-res JPEG from Pentax (K10D) Adobe-DNG files?
Post by: go4java on April 04, 2010, 12:00:01 PM
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
Title: Re: How to extract high-res JPEG from Pentax (K10D) Adobe-DNG files?
Post by: Beholder3 on January 15, 2012, 05:03:52 PM
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) ?
Title: Re: How to extract high-res JPEG from Pentax (K10D) Adobe-DNG files?
Post by: Phil Harvey on January 15, 2012, 05:15:30 PM
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 (https://exiftool.org/config.html) has an example user-defined tag called BigImage which extracts the largest available preview image from any format RAW file.

- Phil
Title: Re: How to extract high-res JPEG from Pentax (K10D) Adobe-DNG files?
Post by: Beholder3 on January 15, 2012, 06:12:42 PM
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 (http://owl.phy.queensu.ca/%7Ephil/exiftool/config.html) 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"?

Title: Re: How to extract high-res JPEG from Pentax (K10D) Adobe-DNG files?
Post by: Phil Harvey on January 15, 2012, 07:10:36 PM
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