Changing Definition of Built-in MP Composite Tag

Started by blue-j, October 25, 2020, 12:50:04 AM

Previous topic - Next topic

blue-j

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

StarGeek

#1
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


* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

blue-j

You are incredibly generous with your time and knowledge.  Thank you!  Deep bow.  - J

blue-j

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)',
        },