ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: sebastian on November 21, 2011, 08:30:08 AM

Title: Photoshop JPEG_Quality Tags
Post by: sebastian on November 21, 2011, 08:30:08 AM
Hi,
how can in adress the "Photoshop JPEG_Quality Tags" in the Config File?

I like to change the PhotoshopFormat Tag.

Quote0x0406 => {
            Name => 'PhotoshopFormat',
            Writable => 1,
            ValueConv => '\$val',
            ValueConvInv => '$val',
        },

What is the correct Hex Offset for these Tags?
How can i set them to writable with the Config File?

Quote
0    PhotoshopQuality
1    PhotoshopFormat
2    ProgressiveScans


Thanks!
Title: Re: Photoshop JPEG_Quality Tags
Post by: Phil Harvey on November 21, 2011, 08:48:26 AM
Hi Sebastian,

The Photoshop Tag Name documenation (https://exiftool.org/TagNames/Photoshop.html) lists the Tag ID's of the Photoshop tags.  Also, see the Photoshop.pm source code (http://cpansearch.perl.org/src/EXIFTOOL/Image-ExifTool-8.65/lib/Image/ExifTool/Photoshop.pm) for examples of how these tags are defined.

- Phil
Title: Re: Photoshop JPEG_Quality Tags
Post by: sebastian on November 21, 2011, 09:02:31 AM
Hi Phil,
thanks for your fast response!

In the "Photoshop Tag Name documenation" i only find the tag id 0x0406 for JPEG_Quality, i thinks this is a tag group because there are the child tags: PhotoshopQuality, PhotoshopFormat and ProgressiveScans

The Photoshop.pm has many answers:
Quote# Photoshop JPEG quality record (ref 2)
%Image::ExifTool::Photoshop::JPEG_Quality = (
    PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
    WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
    FORMAT => 'int16s',
    GROUPS => { 2 => 'Image' },
    0 => {
        Name => 'PhotoshopQuality',
        Writable => 1,
        PrintConv => '$val + 4',
        PrintConvInv => '$val - 4',
    },
    1 => {
        Name => 'PhotoshopFormat',
        PrintConv => {
            0x0000 => 'Standard',
            0x0001 => 'Optimised',
            0x0101 => 'Progressive',
        },
    },
    2 => {
        Name => 'ProgressiveScans',
        PrintConv => {
            1 => '3 Scans',
            2 => '4 Scans',
            3 => '5 Scans',
        },
    },
);

But how can i put this in my config file?

This won't work..
Quote'Image::ExifTool::Photoshop::JPEG_Quality' => {
        0x0406 => {
          GROUPS => { 2 => 'Image' },
          0 => {
              Name => 'PhotoshopQuality',
              Writable => 1,
              PrintConv => '$val + 4',
              PrintConvInv => '$val - 4',
          },
          1 => {
              Name => 'PhotoshopFormat',
              Writable => 1,
              PrintConv => {
             
                  0x0000 => 'Standard',
                  0x0001 => 'Optimised',
                  0x0101 => 'Progressive',
              },
          },
          2 => {
              Name => 'ProgressiveScans',
              Writable => 1,
              PrintConv => {
                  1 => '3 Scans',
                  2 => '4 Scans',
                  3 => '5 Scans',
              },
          },
        }
Title: Re: Photoshop JPEG_Quality Tags
Post by: Phil Harvey on November 21, 2011, 09:11:50 AM
Hi Sebastian,

Duplicating %Image::ExifTool::Photoshop::JPEG_Quality in your config file doesn't make much sense unless you want to change something in this table.  You still won't be able to create a JPEG Quality record if one didn't exist before.  Is this what you want to do?

But just for the record, the config file would look like this:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Photoshop::Main' => {
        0x0406 => {
            Name => 'JPEG_Quality',
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::JPEG_Quality',
            },
        },
    },
);

%Image::ExifTool::UserDefined::JPEG_Quality = (
    PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
    WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
    FORMAT => 'int16s',
    GROUPS => { 2 => 'Image' },
    0 => {
        Name => 'PhotoshopQuality',
        Writable => 1,
        PrintConv => '$val + 4',
        PrintConvInv => '$val - 4',
    },
    1 => {
        Name => 'PhotoshopFormat',
        PrintConv => {
            0x0000 => 'Standard',
            0x0001 => 'Optimised',
            0x0101 => 'Progressive',
        },
    },
    2 => {
        Name => 'ProgressiveScans',
        PrintConv => {
            1 => '3 Scans',
            2 => '4 Scans',
            3 => '5 Scans',
        },
    },
);
1; #end


- Phil
Title: Re: Photoshop JPEG_Quality Tags
Post by: sebastian on November 21, 2011, 09:26:40 AM
Hi Phil,
i like to change or create the tags PhotoshopFormat, ProgressiveScans (PhotoshopQuality works)

Sample command:
Quoteexiftool.exe -config ExifTool.config -Photoshop:PhotoshopQuality="12" -Photoshop:PhotoshopFormat="0x0001" -Photoshop:ProgressiveScans="3 Scans" photoshop_referenz.jpg





Title: Re: Photoshop JPEG_Quality Tags
Post by: Phil Harvey on November 21, 2011, 09:33:10 AM
OK.  Making these tags writable will allow you to change them, but not create them if they didn't exist.  The only way to create this information is to copy it from another file with a different configuration.  See this thread (https://exiftool.org/forum/index.php/topic,3690.0.html) for an example of how to do this.

- Phil
Title: Re: Photoshop JPEG_Quality Tags
Post by: sebastian on November 21, 2011, 09:58:23 AM
Ok, but how can i change them?

There is no tag id for the tags... PhotoshopFormat, ProgressiveScans
Title: Re: Photoshop JPEG_Quality Tags
Post by: Phil Harvey on November 21, 2011, 11:17:30 AM
To enable writing of these tags, just set "Writable => 1," in the config file I posted.

- Phil
Title: Re: Photoshop JPEG_Quality Tags
Post by: sebastian on November 22, 2011, 12:15:38 PM
Thanks Phil. It works.