ExifTool Command Line - Edit EXIF image metadata on Linux

How to edit EXIF metadata via the command line with ExifTool

Last updated on March 30, 2023

In a previous post, I tried to find a metadata editor with a graphical user interface on Linux. The best solution, DigiKam, is designed for KDE. The second best option, XnView, is perfectible and not free software.

As a Linux Mint (Cinnamon) user, I ended up thinking that it would be better to use a command line tool for my simple metadata editing needs. Of the two available command line tools, Exiv2 and ExifTool. I chose ExifTool, which can be installed through the Software Center / Synaptic / Package manager or via the command line:

sudo apt-get install libimage-exiftool-perl

1. Display metadata information

Nothing easier: ExifTool can display image metadata information of a single file:

exiftool "file name.extension"

To display metadata info of all files in a directory, use a dot ‘.‘ as in the following example (the output can be quite long):

exiftool .

ExifTool allows you to change all Metadata information on pictures, including Copyright, Creative Commons, etc.

ExifTool displaying image metadata

Metadata information can also be exported to an html document:

exiftool -h . > example.html

2. Add copyright information to image metadata on Linux

Copyright Notice and XMP Rights

After trying out a lot of metadata tags and testing the results, I recommend using both the -rights and -CopyrightNotice with identical content for copyright information.

More details: the -rights option seems to be a shorthand for -XMP-dc:Rights, and definitely a better solution than using the -copyright option, which doesn’t seem to produce readable results by gThumb and Gnome Image Viewer. The -CopyrightNotice option also works reliably and populates the ITPC CopyrightNotice field. The options -EXIF:Copyright and -copyright produce disappointing results in terms of compatibility with standard image managers on Linux.

Here is how to add standard copyright information to a file:

exiftool -rights="Copyright" -CopyrightNotice="Copyright" "file name.extension"

Batch metadata editing: Replace the file name with a directory name to modify all files in a directory. Use a dot ‘.‘ for the current directory.

A few more tips:

  • Remember that extensions and filenames are case sensitive on Linux. Especially when using wildcards, *.jpg is not the same as *.JPG.
  • ExifTool creates a copy of the original file, appending _original to the file name, as a backup. To avoid that and modify files directly, use the -overwrite_original option.

Here is a full example with a standard American copyright notice and no backup file:

exiftool -overwrite_original -rights="©2023 John Doe, all rights reserved" -CopyrightNotice="©2023 John Doe, all rights reserved" "file name.extension"

Changing copyright metadata information on Linux

Add Creator / Author to image metadata

Here we want to add or change creator/author information of the XMP Dublin Core standard schema:

exiftool -XMP-dc:Creator="Creator" "file name.extension"

Change the Author / Creator of an image in the Metadata / Exif information on Linux

Copyright Notice an Creator metadata changes in one single command

exiftool -overwrite_original -rights="©2023 John Doe, all rights reserved" -CopyrightNotice="©2023 John Doe, all rights reserved" -XMP-dc:Creator="Creator" "file name.extension"

3. Edit Creative Commons rights information

The Creative Commons official recommendation concerning XMP metadata information is to use identical content for the dc:rights and xmpRights:UsageTerms fields.

exiftool -overwrite_original -XMP-dc:Rights="This work is licensed to the public under the Creative Commons Attribution-ShareAlike license http://creativecommons.org/licenses/by-sa/4.0/" -xmp:usageterms="This work is licensed to the public under the Creative Commons Attribution-ShareAlike license http://creativecommons.org/licenses/by-sa/4.0/" "file name.extension"

Also according to the Creative Commons recommendation, xmpRights:Marked soud be set to False if Public Domain, True otherwise. Here is an example to set the field to True:

exiftool -overwrite_original -xmp:usageterms=True "file name.extension"

Add a Creative Commons License to image metadata

Using the Creative Commons schema

Here are some examples for modifying the Creative Commons schema:

License URL

exiftool -overwrite_original -XMP-cc:license="http://creativecommons.org/licenses/by-sa/4.0/" "file name.extension"

Attribution name

exiftool -overwrite_original -XMP-cc:AttributionName="Creator" "file name.extension"

Attribution URL

exiftool -overwrite_original -XMP-cc:AttributionURL="Creator URL" "file name.extension"

Example combining License URL, attribution name and URL

exiftool -overwrite_original -XMP-cc:license="http://creativecommons.org/licenses/by-sa/4.0/" -XMP-cc:AttributionName="Creator" -XMP-cc:AttributionURL="http://creatorURL.com" "file name.extension"

Creative Commons Schema edit

Combining the CC right informations and Creative Commons schema

Here is an example for changing all metadata following the Creative commons recommendations:

exiftool -overwrite_original -XMP-dc:Rights="This work is licensed to the public under the Creative Commons Attribution-ShareAlike license http://creativecommons.org/licenses/by-sa/4.0/" -xmp:usageterms="This work is licensed to the public under the Creative Commons Attribution-ShareAlike license http://creativecommons.org/licenses/by-sa/4.0/" -XMP-cc:license="http://creativecommons.org/licenses/by-sa/4.0/" -XMP-cc:AttributionName="Creator" -XMP-cc:AttributionURL="http://creatorURL.com" "file name.extension"

Final result:

All metadata information follwoing the Creative Commons recommendations

Remove all metadata

Remove all metadata from a file:

exiftool -all= -overwrite_original "file name.extension"

Remove all metadata from the current directory:

exiftool -all= -overwrite_original .

Remove all metadata from all png files in the working directory:

exiftool -all= -overwrite_original -ext png .

By Johannes Eva, May 2016 – March 2023

Articles by categories

Most Read Articles

Comments

15 thoughts on “How to install LibreOffice 24.2 on Linux Mint, Ubuntu, MX Linux, Debian…”

  1. You may use the official appimage in Libre Office as well. In fact, on Linux Mint 21 you can’t get rid of the default LO as it may lead to dependency issues. Appimage helps.

  2. Pingback: Ubuntu 21.04: Essentials – Linux Sagas

  3. Issuing $ sudo apt-get remove libreoffice-core installs an office core no gui. With or without purging. Yielding this:
    The following packages will be REMOVED:
    libreoffice-base libreoffice-calc libreoffice-core libreoffice-draw libreoffice-gnome libreoffice-gtk3 libreoffice-impress libreoffice-lightproof-ru-ru libreoffice-math libreoffice-nlpsolver libreoffice-report-builder libreoffice-report-builder-bin libreoffice-script-provider-python libreoffice-sdbc-postgresql libreoffice-wiki-publisher python3-uno
    The following NEW packages will be installed:
    libreoffice-core-nogui

    Many thanks for any clarification!

    1. Right! The correct command for removing completely the stock LibreOffice on Linux is the following:
      sudo apt purge libreoffice-common

      The following command also works but misses some packages:
      sudo apt purge libreoffice*

      Thank you for your comment, I updated the article accordingly.

  4. NOTE:- I found that Libre Office version 6.3.2.2 is extremely buggy, it has major dependency problems attempting to install on Linux Mint (Tina 19.2). I wasn’t able to resolve these problems so had to revert the install (remove 6.3.2.2-2) and return to previous version 6.3.1 which works fine.

    **Windows 10 (1903) ALSO NOTE that LO 6.3.2.2 installs on W10 but also caused major performance issues and hung my system on reboot. My machine Borked badly so once again had to revert back to LO 6.3.1 which works fine.

  5. Thanks for the Terminal codes. Newbies like me just want it to work and your codes provide the copy and paste necessities for Linux to do its magic.

    (If it can’t be done in Linux (and LibreOffice) its not worth doing)

  6. please help me with this error, newbee here

    root@Anon:~/libreoffice# sudo dpkg -i *.deb
    dpkg: error: dpkg status database is locked by another process
    root@Anon:~/libreoffice# cd LibreOffice_6.0.2.1_Linux_x86_deb
    root@Anon:~/libreoffice/LibreOffice_6.0.2.1_Linux_x86_deb# sudo dpkg -i *.deb
    dpkg: error: dpkg status database is locked by another process
    root@Anon:~/libreoffice/LibreOffice_6.0.2.1_Linux_x86_deb# cd debs
    bash: cd: debs: No such file or directory
    root@Anon:~/libreoffice/LibreOffice_6.0.2.1_Linux_x86_deb# cd DEBS
    root@Anon:~/libreoffice/LibreOffice_6.0.2.1_Linux_x86_deb/DEBS# sudo dpkg -i *.deb
    dpkg: error: dpkg status database is locked by another process
    root@Anon:~/libreoffice/LibreOffice_6.0.2.1_Linux_x86_deb/DEBS# sudo dpkg -i *.deb
    dpkg: error: dpkg status database is locked by another process

    1. The last line says it all: check if you are running another instance of dpkg. In last resort, try to remove dpkg lock file:

      sudo rm /var/lib/dpkg/lock

      Then let dpkg fix itself:
      sudo dpkg --configure -a

      Note that this problem is not per se related to LibreOffice.

  7. Would be useful to know how to install such alongside the native repository install of LibreOffice – without conflict. Would be useful to be able to choose, say, LibreOffice Writer 5.2, vs just LibreOffice Writer. Migrations / new versions not always working as seamlessly as one might like with files one might already have. It can be very frustrating to have a new version munge (e.g. formatting) of a current document one depends on, and not being able to ‘un-munge’ it.

  8. Works well. The only problem I had is that the icons were not created. I created them manually by running Writer, Calc and Impress and the using the “Lock to Launcher” option. This is how to run them from the terminal:

    Writer: /opt/libreoffice5.0/program/oosplash –writer
    Calc: /opt/libreoffice5.0/program/oosplash –calc
    Impress: /opt/libreoffice5.0/program/oosplash –impress

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.