Extracting preview Image from PEF RAW file

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

Previous topic - Next topic

BogdanH

Quote from: Beholder3 on June 19, 2012, 07:12:46 AM
You can take this here from DPReview:
http://movies.dpreview.com.s3.amazonaws.com/pentax_k5/IMGP3854.DNG.zip
I just did that and here (again) I get nothing from this file by using:
exiftool -b -BigImage -w %f.jpg IMGP3854.DNG
-and BigImage also isn't listed in Composite (I have latest ExifTool v8.95). Now I am really getting curious  ???

Bogdan

Beholder3

Huh?
I just upgraded to 8.95 but still I get the BigImage using exiftoolGUI.
???

Using Windows 7 64bit Ultimate, exiftoolGui 5.14 and exiftool 8.95.

Beholder3

One question to Phil as add on:
Does that actually mean, these files (DNG/PEF) really do contain the same fullsize "preview" JPG twice, each stored in a different "area"? or is it only two "pointers" pointing to the same JPGs?

Phil Harvey

The Composite BigImage tag is just a duplicate of the biggest JPG image in the file.

There are 2 PreviewImage's in the DNG, but they are different (different resolutions and file sizes).

Regarding the BigImage confusion:  This is one of the user-defined tags in the sample config file.  So Beholder3 must have the sample config file installed.

- 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've downloaded ExifTool again, deleted "par" directory in Temp, and ran above command again -same result: BigImage isn't there. To be sure, I've executed command in console too. Otherwise, same GUI version, and Win7 x64.
Are we using the same IMGP3854.DNG image? I mean, this IS weird.

Bogdan

Beholder3

Quote from: Phil Harvey on June 19, 2012, 12:13:30 PM
Regarding the BigImage confusion:  This is one of the user-defined tags in the sample config file.  So Beholder3 must have the sample config file installed.

Ah, yes.  :) Just checked it. I must have inserted the code into the config file some months ago when I first played around with the preview extraction. I forgot about it and assumed its "standard".

That is the code in .ExifTool_config

# [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;

BogdanH


Beholder3

Sorry. I found one more thing in this DNG:

Quote---- ExifTool ----
ExifTool Version Number         : 8.95
---- File ----
File Name                       : IMGP3854.DNG
Directory                       : .
File Size                       : 22 MB
File Modification Date/Time     : 2010:12:16 18:50:58+01:00
File Permissions                : rw-rw-rw-
File Type                       : DNG
MIME Type                       : image/x-adobe-dng
Exif Byte Order                 : Big-endian (Motorola, MM)
---- EXIF ----
Subfile Type                    : Reduced-resolution image
Image Width                     : 160
Image Height                    : 120


For one there seems to be no such preview file in there which should be extractable, as we learned there are no real small thumbnails in there in the DNG.


For two in the output at the same time I can find nothing about a Reduced resolution image with 640 x 480 which is actually extractable.

I see three options:

a) There is a mini 160x120 preview which we cant yet extract plus there is a 640x480 preview which doesnt show in exiftools output in detail
b) there is a mini 160x120 preview in there and it is being saved in a blown up way (dont really believe this)
c) exiftool misinterprets the dimensions by factor 4.



Phil Harvey

The option is a).

The 160x120 preview is not extracted by ExifTool because it is not JPEG format.  (Look at the Compression tag)

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