Remove space in camera temperature

Started by txastro, February 14, 2012, 09:23:27 AM

Previous topic - Next topic

txastro

I have tried but haven't been able to remove the space in the camera temperature (20 C to 20C).  Instead of removing the space, everything following the number is removed (20 C to 20).  I thought I probably had a typo I couldn't find, so I tried the following snippet to change spaces to underscores.


CameraTemperature2 => {
            Require => 'CameraTemperature',
            ValueConv => '$val =~ tr/ /_/; $val',
        },

Even using this everything after the number is removed.  Since the behavior is not what I was wanting, I am not even sure that the entire numeric portion remains.  On the few images I checked the numeric temperature value is correct, but I have a little over 20k images.

Am I missing something in the code?

Thanks,
Xavier

Phil Harvey

Hi Xavier,

The "C" is added in the print conversion, so you can do what you want by adding the C yourself to the ValueConv value.  I would add the C in the print conversion here too, but without the space:

        ValueConv =>'$val',
        PrintConv => '"${val}C"',

This could also be done without the need for a user-defined tag:

exiftool -p "$cameratemperature#C" FILE

(use single quotes in Mac/Linux, or double quotes as above in Windows)


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

txastro

Thanks.  That worked great and was so simple.

Xavier