ExifTool Forum

ExifTool => ExifTool GUI => Topic started by: pedro22 on February 02, 2017, 12:04:44 PM

Title: User defined - two values in one column
Post by: pedro22 on February 02, 2017, 12:04:44 PM
Is it possible to use two values in one column, but not the same time - I have a column Quality and wants to use -PhotoshopQuality and -Quality that is, if there is no value PhotoshopQuality let it display Ducky quality.
Title: Re: User defined - two values in one column
Post by: Phil Harvey on February 02, 2017, 12:23:47 PM
Yes.  You can do this by creating a user-defined Composite tag which is based on PhotoshopQuality and Quality.  The ValueConv for this tag would be simple:

    ValueConv => '$val[0] || $val[1]',

See the sample config file (https://exiftool.org/config.html) for documentation and examples of user-defined tags.

- Phil
Title: Re: User defined - two values in one column
Post by: pedro22 on February 02, 2017, 12:34:34 PM
Thanks Phil - but not what I continue to do with it, insert this file into the folder ExifToolGUI?
Title: Re: User defined - two values in one column
Post by: pedro22 on February 03, 2017, 05:49:15 AM
Can anyone help me - I really do not like to use it, still learning ExifTool.
Title: Re: User defined - two values in one column
Post by: Phil Harvey on February 03, 2017, 07:25:52 AM
Did you read the instructions starting with "To activate this file,..." in the comments of the sample config file I linked?

- Phil
Title: Re: User defined - two values in one column
Post by: pedro22 on February 03, 2017, 07:31:08 AM
OK, I changed the name to ".ExifTool_config" and put the file in the folder ExifTool - what next?
Title: Re: User defined - two values in one column
Post by: Phil Harvey on February 03, 2017, 07:59:32 AM
You're supposed to put it in your home directory.

Then edit the file to add a definition like this to the Composite tags section:

        MyQuality => {
            Require => {
                0 => 'PhotoshopQuality',
                1 => 'Quality',
            },
            ValueConv => '$val[0] || $val[0]',
        },


Then use "MyQuality" in ExifToolGUI.

- Phil
Title: Re: User defined - two values in one column
Post by: pedro22 on February 03, 2017, 08:22:28 AM
Unfortunately, it does not work - I put the file ".ExifTool_config" in the C:\Windows and changed a sample entry to the specified by you. Then in ExifToolGUI I entered "MyQuality" or "-MyQuality" without the quotes, and does not work.
Title: Re: User defined - two values in one column
Post by: Phil Harvey on February 03, 2017, 08:29:33 AM
Not in C:\Windows.  I said in your home directory.  (Something like "C:\Documents and Settings\USERNAME" or something, depending on what Windows version you are running.)

- Phil
Title: Re: User defined - two values in one column
Post by: pedro22 on February 03, 2017, 08:37:30 AM
It also does not work - I put the file in "C:\Documents and Settings\Michał"
Title: Re: User defined - two values in one column
Post by: Phil Harvey on February 03, 2017, 08:43:16 AM
OK.  Try this from the command line to see what happens and if it gives any errors:

exiftool -myquality -quality -photoshopquality FILE

- Phil
Title: Re: User defined - two values in one column
Post by: pedro22 on February 03, 2017, 08:56:38 AM
Done:

C:\Documents and Settings\Michał>exiftool -myquality -quality -photoshopquality
"C:\Documents and Settings\Michał\Moje dokumenty\Moje obrazy\351001.jpg"
Unterminated <> operator at C:\Documents and Settings\Micha│/.ExifTool_config li
ne 347.
Photoshop Quality               : 6

C:\Documents and Settings\Michał>exiftool -myquality -quality -photoshopquality
"C:\Documents and Settings\Michał\Moje dokumenty\Pobieranie\lol012IGD_145316017.
jpg"
Unterminated <> operator at C:\Documents and Settings\Micha│/.ExifTool_config li
ne 347.
Quality                         : 66%
Title: Re: User defined - two values in one column
Post by: Phil Harvey on February 03, 2017, 09:00:13 AM
Ah.  You had this at the bottom on the file:

<-- Back to ExifTool home page

The attached config file should work for you (I also fixed an error of mine: "Require" should have been "Desire" for the new tag).

(Note: you'll have to rename the config file to ".ExifTool_config" -- also, remove any old versions you have lying around in C:\Windows, etc)

- Phil
Title: Re: User defined - two values in one column
Post by: pedro22 on February 03, 2017, 09:01:00 AM
I noticed a difference in the codes that you provided:

1.    ValueConv => '$val[0] || $val[1]',
2.MyQuality => {
            Require => {
                0 => 'PhotoshopQuality',
                1 => 'Quality',
            },
            ValueConv => '$val[0] || $val[0]',
        },

perhaps by it does not work?
Title: Re: User defined - two values in one column
Post by: Phil Harvey on February 03, 2017, 09:02:06 AM
Oops.  You're right.  Here is a fixed version.

- Phil
Title: Re: User defined - two values in one column
Post by: pedro22 on February 03, 2017, 09:12:32 AM
Apparently well, but in the column PhotoshopQuality have a value of 10 in a MyQuality 6 - and instead of 66% is 66
Title: Re: User defined - two values in one column
Post by: Phil Harvey on February 03, 2017, 09:38:17 AM
I don't understand what you want, but you can do mathematical manipulations in the ValueConv statement if necessary.

- Phil
Title: Re: User defined - two values in one column
Post by: pedro22 on February 03, 2017, 10:06:15 AM
What I mean is that: if there is no value -PhotoshopQuality is that the column was not empty, let's display the value of the tag -quality - and now it is almost: but the real value -PhotoshopQuality is reduced by 4 in column MyQuality

real value: 10 now 6 should be displayed 10
real value: 6 now 2 should be displayed 6

and does not display % sign for Ducky quality via ".ExifTool_config"

the only thing that is good: value NORMAL for Nikon quality

And in ExifToolGUI I can not use "-*Quality" to solve a problem or a separator (sign or) -PhotoshopQuality | -Quality
Title: Re: User defined - two values in one column
Post by: Phil Harvey on February 03, 2017, 10:25:19 AM
Ah, I see.  There were print conversions for these tags that you want to keep.  Try changing the ValueConv to this:

    ValueConv => '$prt[0] || $prt[1]',

- Phil
Title: Re: User defined - two values in one column
Post by: pedro22 on February 03, 2017, 10:52:55 AM
That's exactly what it was! Thanks Phil!
if only this line is important?
MyQuality => {
            Desire => {
                0 => 'PhotoshopQuality',
                1 => 'Quality',
            },
            ValueConv => '$prt[0] || $prt[1]',
        },

I wanted to delete the remaining entries - unless it does not affect the speed of reading the data.

Can I use this file to see all the 'Unknown tags"?
Title: Re: User defined - two values in one column
Post by: Phil Harvey on February 03, 2017, 11:24:08 AM
Quote from: pedro22 on February 03, 2017, 10:52:55 AM
That's exactly what it was! Thanks Phil!

Great.

Quoteif only this line is important?

yes.

QuoteI wanted to delete the remaining entries - unless it does not affect the speed of reading the data.

I don't know what you mean.  Do you mean remove the other columns in ExifToolGUI?  I don't know about this.

QuoteCan I use this file to see all the 'Unknown tags"?

The config file doesn't help with that, but the GUI should have an option to show unknown tags (equivalent to the -u option on the command line).

- Phil
Title: Re: User defined - two values in one column
Post by: pedro22 on February 03, 2017, 12:23:09 PM
Quote from: Phil Harvey on February 03, 2017, 11:24:08 AM
Quote from: pedro22 on February 03, 2017, 10:52:55 AM

I wanted to delete the remaining entries - unless it does not affect the speed of reading the data.

I don't know what you mean.  Do you mean remove the other columns in ExifToolGUI?  I don't know about this.
I mean the other lines in ".ExifTool_config" or affect the performance ExifTool or ExifToolGUI because I noticed that the ET reads much more tags especially in the Composite

or whether to leave in ".ExifTool_config" this one line and it will work.
Title: Re: User defined - two values in one column
Post by: Phil Harvey on February 03, 2017, 12:25:59 PM
Ah, I see.  Here is the minimal config file:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        MyQuality => {
            Desire => {
                0 => 'PhotoshopQuality',
                1 => 'Quality',
            },
            ValueConv => '$prt[0] || $prt[1]',
        },
    },
);
1;  #end


- Phil
Title: Re: User defined - two values in one column
Post by: pedro22 on February 03, 2017, 12:44:57 PM
Many Thanks Phil!

A fantastic tool!

One more thing I have learned a little, but as I wanted to in the future to add other tags such a function where? - Or rather in which place.

Do these lines have to be repeated:
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {

or insert almost the same after the line:
ValueConv => '$prt[0] || $prt[1]',
Title: Re: User defined - two values in one column
Post by: Phil Harvey on February 03, 2017, 12:49:11 PM
Your question should be answered by looking at the sample config file.

- Phil