Author Topic: Emit blanks in metadata values?  (Read 93 times)


  • Sr. Member
  • ****
  • Posts: 261
Emit blanks in metadata values?
« on: November 08, 2020, 05:37:39 AM »
Regarding this thread ( I wondered how I could make ExifTool include blanks in the output.
The file in question had additional blanks in the make/model tag. I was able to see them in a binary editor, but I was unable to produce output with ExifTool that included these blanks.

I tried various things and checked the docs, but I could not find a "Don't trim" command line argument...?

For example, when I do a >exiftool -php -exif:make -exif:model filename I get

  "ImageDescription" => "OLYMPUS DIGITAL CAMERA         ",
  "Model" => "PEN-F",

Trailing blanks in the description, but none in the make/model.
Similar for JSON output or piping into a text file. I use Windows.

Is there a flag I need to use to see the actual data? I tried -b too, but to no avail.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17190
    • ExifTool Home Page
Re: Emit blanks in metadata values?
« Reply #1 on: November 08, 2020, 12:26:32 PM »
The Make and Model tags are handled specially because they are used as keys to decide the formatting of the maker notes (amongst other things), so you can't avoid trimming these with any command-line option.  Instead,  you could override the Make and Model tag definitions with user-defined tags to avoid trimming the spaces.  Here is a config file that would do this:

Code: [Select]
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Exif::Main' => {
        0x10f => {
            Name => 'Make',
            Groups => { 2 => 'Camera' },
            Writable => 'string',
            WriteGroup => 'IFD0',
            DataMember => 'Make',
            RawConv => '($$self{Make} = $val) =~ s/\s+$//; $val',
        0x110 => {
            Name => 'Model',
            Description => 'Camera Model Name',
            Groups => { 2 => 'Camera' },
            Writable => 'string',
            WriteGroup => 'IFD0',
            DataMember => 'Model',
            RawConv => '($$self{Model} = $val) =~ s/\s+$//; $val',
1; #end

Note that I'm still trimming the internal Make and Model variables to avoid breaking the makernote recognition, but the tag value won't be trimmed any more.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).


  • Sr. Member
  • ****
  • Posts: 261
Re: Emit blanks in metadata values?
« Reply #2 on: November 09, 2020, 08:21:51 AM »
Ah, that explains that. It's always easy when you know how  ;)
I will file that away for when I need it again.

I generally try not to fiddle with the way ExifTool works, because that way it works best.

It's only the rare fringe cases like SilkyPix refusing to load an image because it expects a certain number of trailing blanks in the make tag which require this kind treatment.
Thanks again for figuring out the problem. SilkyPix has fixed it now, too.