ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: blue-j on October 25, 2020, 12:50:04 AM

Title: Changing Definition of Built-in MP Composite Tag
Post by: blue-j on October 25, 2020, 12:50:04 AM
I would like to change Megapixels to be displayed in the thousandths rather than tenths.  How can I do that?  (I don't mean by adding the -n switch, I mean permanently somewhere so the command doesn't need to change.)

Example, Megapixels = 1.234 instead of 1.2

Thanks in advance for your support!  I hope you are well.

- J
Title: Re: Changing Definition of Built-in MP Composite Tag
Post by: StarGeek on October 25, 2020, 11:07:48 AM
Here's a short config file to do this.  Copy the stuff between Cut/Paste if you want to add it to your .exiftool_config  It will create a new tag called MyMegapixels
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
#-------------------------------- Cut
        MyMegapixels => {
Require =>  'Megapixels' ,
ValueConv => '$val = sprintf("%.3f",$val)',
},
},
#-------------------------------- Paste
);
#-
1;  #end


Title: Re: Changing Definition of Built-in MP Composite Tag
Post by: blue-j on October 25, 2020, 10:37:08 PM
You are incredibly generous with your time and knowledge.  Thank you!  Deep bow.  - J
Title: Re: Changing Definition of Built-in MP Composite Tag
Post by: blue-j on November 21, 2020, 05:39:22 PM
I had to edit the code slightly to make it work, and I thought I'd leave it here in case it is helpful to anyone else in the future:

        MyMegapixels => {
                Require => {
                 0 => 'Megapixels',
                },
                ValueConv => '$val = sprintf("%.3f",$val)',
        },