diff --git a/README.md b/README.md index ba529af..a4809c2 100644 --- a/README.md +++ b/README.md @@ -490,6 +490,9 @@ IMAGE_PROCESS_COPY_EXIF_TAGS = True Note that `exiftool` prior to version 12.46 cannot write WebP images, so if you work with WebP images, you should use version 12.46 or later. +When copying EXIF tags, the plugin will update `ExifImageWidth` and +`ExifImageHeight` tags to reflect the dimensions of the transformed image. + #### Modifying the `class` Attribute of Processed Images By default, *Image Process* adds the `image-process-` @@ -520,9 +523,12 @@ IMAGE_PROCESS_ADD_CLASS = False ## Contributing -Contributions are welcome and much appreciated. Every little bit helps. You can contribute by improving the documentation, adding missing features, and fixing bugs. You can also help out by reviewing and commenting on [existing issues][]. +Contributions are welcome and much appreciated. Every little bit helps. You can +contribute by improving the documentation, adding missing features, and fixing bugs. +You can also help out by reviewing and commenting on [existing issues][]. -To start contributing to this plugin, review the [Contributing to Pelican][] documentation, beginning with the **Contributing Code** section. +To start contributing to this plugin, review the [Contributing to Pelican][] +documentation, beginning with the **Contributing Code** section. [existing issues]: https://github.com/pelican-plugins/image-process/issues [Contributing to Pelican]: https://docs.getpelican.com/en/latest/contribute.html diff --git a/pelican/plugins/image_process/image_process.py b/pelican/plugins/image_process/image_process.py index 82b7c93..c5537c1 100644 --- a/pelican/plugins/image_process/image_process.py +++ b/pelican/plugins/image_process/image_process.py @@ -75,7 +75,7 @@ def __init__(self): with contextlib.suppress(LookupError): codecs.lookup_error("surrogateescape") - with open(os.devnull, "w") as devnull: + with open(os.devnull, "w"): self.process = subprocess.Popen( [ "exiftool", @@ -89,7 +89,7 @@ def __init__(self): ], stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=devnull, + stderr=subprocess.STDOUT, ) def __del__(self): @@ -101,7 +101,20 @@ def _copy_tags(self, src, dst): params = ( b"-TagsFromFile", src.encode(self.encoding, ExifTool.errors), - b'"-all:all>all:all"', + dst.encode(self.encoding, ExifTool.errors), + ) + self._send_command(params) + params = ( + b"-ExifImageWidth