Extracting ThumbnailImage Creates UnViewable File

Started by machouinard, March 01, 2012, 05:16:03 PM

Previous topic - Next topic

machouinard

I can generate files which appear to be the correct size using this with PHP:

`exiftool -b ThumbnailImage $image>$thumb`

but I'm unable to view them.  I read here about the age-old newline problem. This code was included in the post:

   open (OUT, '>perl.jpg') or die "cannot open perl.jpg";
        binmode OUT;
   print OUT $$val;

Am I looking in the right direction?  If so, how would I go about fixing this in a PHP environment?

Thanks,
Mark

Phil Harvey

You don't need to worry about the binmode.  ExifTool sets that automatically when you use the -b option.  There must be something else going on here, but I don't know what. (Other than the missing "-" in the "-thumbnailimage" argument.)

Did you check the messages that exiftool returns?

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

machouinard

Tried -thumbnailimage -b but all I got were 0 byte files.  Switched to -thumbnailimage -b and it worked a charm.

Thanks, Phil!

Phil Harvey

Quote from: machouinard on March 03, 2012, 08:09:11 PM
Tried -thumbnailimage -b but all I got were 0 byte files.  Switched to -thumbnailimage -b and it worked a charm.

? That's the same thing.

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

machouinard

My mistake.  When I added the missing - to the code in my first post:
`exiftool -b ThumbnailImage $image>$thumb`
I was getting files with 0 bytes.  Just had to place the -b after -thumbnailimage.

Mark

Phil Harvey

Hi Mark,

The order doesn't matter.  -thumbnailimage -b is the same as -b -thumbnailimage.

So something else must have been going on.  I suspect that you accidently misspelled thumbnailimage in one command.

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