changing a photoshop non-writable value

Started by cgray, October 11, 2018, 02:12:53 PM

Previous topic - Next topic

cgray

Hello,  i found this thread
https://exiftool.org/forum/index.php/topic,3760.msg17207.html#msg17207
that leads me to believe even if a Photoshop metadata value is marked as not writable if you use a config file and mark it as Writable it can be written if the meta data is in the file.

So I used the example config on that thread and made each with Writable = > 1.


%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',
        Writable => 1,
        PrintConv => {
            0x0000 => 'Standard',
            0x0001 => 'Optimised',
            0x0101 => 'Progressive',
        },
    },
    2 => {
        Name => 'ProgressiveScans',
        Writable => 1,
        PrintConv => {
            1 => '3 Scans',
            2 => '4 Scans',
            3 => '5 Scans',
        },
    },
);
print "LOADED!\n";
1; #end


If i try to use this config file i still cannot change these values
exiftool -config PSD_JPEGQuality.conf -m -Photoshop:ProgressiveScans=2 311842304.jpg

The file does have this metadata in it.
exiftool -m -Photoshop:ProgressiveScans 311842304.jpg                                               
Progressive Scans               : 3 Scans

What am i doing wrong?

Thanks!
Chad

Phil Harvey

Hi Chad,

I'll have to try this out when I get a chance to be able to tell you exactly what is happing.  I should be able to do this tomorrow.

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

Phil Harvey

OK,  This works:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Photoshop::JPEG_Quality' => {
        2 => {
            Name => 'MyProgressiveScans',
            Writable => 1,
            PrintConv => {
                1 => '3 Scans',
                2 => '4 Scans',
                3 => '5 Scans',
            },
        },
    },
);

1; #end


With a command like this:

exiftool -config my.config -myprogressivescans="3 Scans" FILE

There were 2 problems with what you were doing:

1. An exiftool bug where any argument starting with "-progress" was interpreted as the -progress option (this will be fixed in the next release).  To work around this with the current version of ExifTool, I have changed the tag name to "MyProgressiveScans".

2. You re-defined the JPEG_Quality table without setting the family 0 and 1 group names, so they took the default group of "UserDefined", but they need to be in the "Photoshop" group.  I fixed this in my config file by not re-defining the table, but I could have fixed it by changing your GROUPS definition to this:

    GROUPS => { 0 => 'Photoshop', 1 => 'Photoshop', 2 => 'Image' },


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

cgray

Thanks Phil!

Thats what i get for just copy/pasting code i found and not truly understanding what it does.  I will read up on your config files so understand it better.

I got it to work with another field HasRealMergedData so i can avoid the progress bug and start understanding the config files better.


%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Photoshop::VersionInfo' => {
        4 => {
            Name => 'HasRealMergedData',
            Writable => 1,
            PrintConv => {
0 => 'No',
1 => 'Yes',
            },
        },
    },
);
print "LOADED The CONF!\n";
1; #end