Version history:
================


---
v.2.1.0 - 2026-06-26
 * Added WebP support: existing WebP files are now optimized in place, just
   like PNG and JPEG. Animated WebP files are left untouched.
 * New WebP encoding options: -wq (quality), -wl/--webp-lossless, and -wm
   (method / compression effort).
 * Format conversion was generalized. The new -cf/--convert-to FORMAT option
   chooses the output format; the available targets depend on the codecs
   compiled into the Pillow build in use (typically jpeg, png, webp, avif and
   jpeg2000). The default target remains JPEG, so existing behaviour is kept
   unless the option is used.
 * -ca/--convert-all now converts images of any source format (not only PNG)
   to the chosen target. -cb/--convert-big stays specific to big photographic
   PNGs.
 * Conversion now honours the size comparison just like in-place optimization:
   the converted file is kept only when it actually turns out smaller, unless
   the comparison is disabled with -nc. (Previously, converting forced the
   write regardless of size.)
 * New image inspection: inspect_image(path) returns an ImageMetadata object
   with the image's intrinsic properties (format, mode, dimensions, alpha,
   palette size, progressive/interlaced flags, frame count, DPI, ICC profile
   presence and description, and EXIF). EXIF comes grouped by its standardized
   IFD sections - image (main IFD), camera (Exif sub-IFD) and gps - with raw
   values. A companion helper, format_exif(), optionally renders those values
   for display using standardized EXIF semantics (units like f/1.8 and 50 mm,
   enumerations like Orientation, and combined GPS coordinates). A new
   -i/--info CLI option prints this report for a single image and exits;
   it must be used on its own, with only the image path.
 * Public API (backwards compatible): optimize_single_image() gained
   keyword-only arguments convert_to, webp_quality, webp_lossless and
   webp_method, all with defaults; PublicBatchOptions gained the matching
   fields. New discovery helpers - available_input_formats(),
   available_output_formats() and format_capabilities() - report what the
   running Pillow build can read, write and convert to, so third-party apps can
   populate their own menus. PublicTaskResult is unchanged.
 * Public API: new optimize_image_data(data) optimizes an image given as bytes
   and returns the optimized bytes plus a PublicTaskResult, for callers that
   hold images as binary data rather than files (CMS, object storage,
   databases) and cannot provide a file path. It keeps the original format and
   reuses the same per-format processing as the file-based optimizer, so the
   behaviour (resizing, transparency, EXIF, dynamic quality and the size
   comparison) is identical; format conversion is out of scope for this entry
   point.
 * Public API: new convert_image_data(data, to=...) is the in-memory
   counterpart of format conversion: it converts image bytes to another
   available format (e.g. PNG to WebP) and returns the converted bytes plus the
   resulting format, reusing the same converter as the file-based workflow. As
   with the file conversion, the result is kept only when it is actually
   smaller (unless the comparison is disabled); converting to the source format
   just optimizes it (no conversion); multi-frame sources are left unchanged.
 * UPGRADE NOTE: because WebP is now a supported format, running this tool on a
   folder will also re-encode any WebP files it finds (destructively, in
   place), where previously those files were ignored. Note also the conversion
   size-comparison change described above. As always, keep a backup of the
   originals before processing.

---
v.2.0.0 - 2026-05-26
 * Removed dependency on piexif, since Pillow supports EXIF metadata (thanks to
   @varnav for the alert on this).
 * Refactored some code to make it easier to import optimize-images as a
   package in your python projects, without having to execute the CLI app.
 * Changes in requirements to allow newer versions of Python and dependencies.
 * Removed support for older python versions, keeping only active support
   versions.
 * Initial, experimental support for free threaded python, which seems
   significantly faster (tests and feedback are always very welcome).
 * Removed support for Pythonista/iOS, since it is no longer maintained.
 * Added some basic tests.

---
v.1.5.1 - 2022-04-18
 * New console output options: --quiet, --only-summary, and --only-progress
   (kindly contributed by derenix@Github).
 * Changes in requirements to allow newer versions of Python and dependencies.

---
v.1.5.0 - 2021-05-29
 * Replaced temporary files with in-memory buffers which, at the expense of a
   bit higher RAM usage, prevents unnecessary I/O and may result in faster
   performance when working with slower disks.
 * Added information about the running environment to the -v/--version CLI
   argument, so that you can check which python version is being used, as well
   as some information about required and optional third-party packages.
 * Added a minimum space saving threshold (1% per file). Files are only replaced
   if the space saved is at least 1% of the original file size. Contributed by
   varnav@GitHub.
 * Added a check for the presence of the required package Piexif.
 * Added new methods intended to allow optimize-images to be imported and used
   as a package. The initial refactoring was kindly contributed by Tharindu N.
   (truethari@GitHub)
 * Added custom exceptions to better support the public API.

---
v.1.4.0 - 2020-11-01
 * New feature: watch a directory for changes and optimize any new image file as
   soon as it is created (no multiprocessing for now, sorry). This feature is
   not compatible with Pythonista for iOS, since it requires a third-party
   package called Watchdog, which is currently not available on Pythonista).
 * Long running tasks, like optimizing recursively a folder containing a large
   number of image files, or watching for new files a a directory, can now be
   interrupted by the user with CTRL+C. Instead of an ugly traceback, the final
   report is presented with the usual statistics for the images that were
   processed.
 * Added the ability to specify the number of tasks to run simultaneously, so
   that you can optionally limit the number of processor cores being used by
   this application and keep in reserve some CPU power for any other tasks.

---
v.1.3.6 - 2020-08-02
 * Fixed a UnicodeEncodeError that would occur in some environments when
   printing Emoji to screen (Windows, Haiku, maybe others).
 * Fixed a strange multiprocessing error that apparently only occured on... you
   guessed (yeah, Windows, we are looking at you!...).
 * Improved stability on format detection.
   
---
v.1.3.5 - 2020-04-07
 * Fixed a small bug in unsupported image format treatment.
 * Added experimental support for MPO images, which are now treated as JPEG
   image files (if multiple pictures are present in one MPO file, only the first
   one will be processed).

---
v.1.3.4 - 2020-02-19
 * Ignore unsupported image formats, contributed by Petro (liashchynskyi@GitHub).
 * Added brief instructions (and a script for macOS) for Pillow-SIMD
   installation, as a faster alternative to Pillow.
 
---
v.1.3.3 - 2019-08-06
 * Any temporary files (e.g.: '~temp~filename.jpg') created by this utility
   are now ignored, to avoid stepping on its own feet. As a side effect, if
   you have the strange habit of naming your image files ~temp~something.xxx,
   they will also be ignored. So, please get a better naming scheme until we
   come out with a better solution. ;-)
 * Trying to run optimize-images without Pillow installed now results in a
   simple message being printed out to the screen, instead of a full exception
   traceback.

---
v.1.3.2 - 2019-06-27
 * Added a symbol legend to the beginning of the optimization report, so that
   the user knows what each symbol means.
 * Fixed a UnicodeEncodeError that would occur in some environments when
   printing Emoji to screen.

---
v.1.3.1 - 2019-05-03
 * Fixed a PermissionError that would occur when trying to optimize a single
   image in the current directory without explicitly specifying its path.
 * Added basic Exception handling for piexif related instructions. This is a
   temporary solution that should silence, for now, some errors related to
   issue #3 but we should still check if we can provide a more specific
   treatment for those piexif exceptions. We still have a few TODO items
   related to issue #3. Let's hope they can be addressed in the next release.

---
v.1.3 - 2018-10-10
 * Added dynamic (variable) JPG quality setting.
 * Some code cleaning.

---
v.1.2 - 2018-08-27 - Finally available at PyPI.org!
 * Adding a new big feature: "convert big PNG files to JPG format"
 * Added also an option to convert all PNG files to JPEG format.
 * Added a new option to set background color while doing any PNG operations
   that remove transparency (convert big and reduce colors).
 * Adding an option to set background color in hexadecimal mode (like in HTML).
 * Added an option to convert to grayscale.
 * Added an option to ignore file size comparison between original and
   processed files, allowing to always save anyway the processed version.
 * Added new palette rebuild step for indexed color images (creates images that
   may then be compressed more efficiently using other tools).
 * Added a new "fast mode", that currently skips the (also recently
   implemented) palette rebuild step.
 * Changed the transparency removal algorithm to something better.
 * Created some global constants for iOS console and thread settings.
 * Created a global constant for JPEG quality and raised the default to 80.
 * Adjustments in the downsizing code to better produce the expected behavior.
 * Refactored module into a full package and created the `setup.py` file.
 * Added Portuguese version of the documentation.
 * Other minor changes.

---
v.1.1.1 - 2018-06-24
 * Bug fix in single image optimization.

---
v.1.1 - 2018-06-24
 * Added new options to allow downsizing of images to a maximum width and/or
   height before applying any other optimization (guess what? It really makes
   a huge difference in file sizes…).
 * Added a new option to keep EXIF data in JPEG images (by default, it will
   be discarded).
 * Added a new CLI argument to display current version.
 * Added a new CLI argument to display a list of the currently supported image
   formats.
 * Added some bigger JPEG photos with EXIF to text-images.zip.

---
v.1.0 - 2018-06-20 (First public release)
 * No special dependencies, besides PIL/Pillow (this enables full compatibility
   with iPhones and iPads running Pythonista 3)
 * Basic CLI argument parsing, with separate groups of arguments for JPEG and
   PNG images.
 * Multiprocessing support on multicore and multiprocessor computers for really
   fast operation.
 * Multithreading support on Pythonista/iOS, for slightly improved performance
   (too bad, multiprocessing is currently not supported on that environment).
 * Supports optimization of both folders and individual files.
 * Option to avoid recursion into subdirectories (by default, it will recurse).
 * Option for manually setting JPEG quality (by default, 70%).
 * Option for reducing the number of colors by applying adaptive palette to PNG
   images (by default, 256 colors).
 * Option for manually setting a different maximum number of colors while
   reducing colors.