Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# 📰 Picopt News

## v6.7.0

### Features

- JPEG XL support, read and write, using the internal
[pillow-jxl-plugin](https://github.com/Isotr0py/pillow-jpegxl-plugin) module.
- JXL is now optimized by default. `.jxl` files that previous versions ignored
are re-encoded on a plain `picopt -r` run. Only lossless JXL is touched; lossy
(XYB encoded) JXL is left alone, as lossy WebP is.
- Lossless images convert to JXL with `-c JXL`, which now leads the preference
order for still images ahead of WEBP and PNG.
- New `--convert-jpeg-to-jxl` converts JPEG to JXL losslessly and reversibly:
the JXL stores the original JPEG bitstream and can restore it byte for byte.
Files carrying that reconstruction data are never re-encoded, so the original
JPEG stays recoverable.
- New `--convert-webp-to-jxl` converts lossless WebP to JXL. Off by default
because JXL support is still much thinner than WebP's.
- Both flags require `-c JXL` as well. JPEG and WEBP are formats picopt already
processes by default, so unlike BMP or TIFF they cannot be gated by naming
them with `-x`. A plain `-c JXL` still converts only GIF and PNG.

## v6.6.3

### Fixes
Expand Down
51 changes: 46 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ their current format.
- JPEG images are optimized with MozJpeg's jpegtran.
- WEBP Lossy images are not optimized. There is no current way to preserve
information without running it through a lossy process again.
- Lossy (XYB encoded) JPEG XL images are not optimized, for the same reason.
- JPEG images are the one exception to the rule above: they may be converted to
JPEG XL losslessly, because JPEG XL can store the original JPEG bitstream and
restore it byte for byte. This is opt-in, see below.

### Lossless Images

Expand All @@ -39,8 +43,11 @@ a great deal smaller than uncompressed bitmaps like BMP. As such the best
practice is probably to convert all lossless images to WebP Lossless as now all
major browsers support it. The only downside is that decoding WebP Lossless
takes on average 50% more CPU than PNG. All major desktop and mobile browsers
support WEBP. WEBP is the lossless format of choice. Until perhaps JPEG XL
support arrives for browsers.
support WEBP. WEBP is the lossless format of choice, until JPEG XL support
arrives for browsers.

Lossless JPEG XL is usually smaller still, and picopt can convert to it with
`-c JXL`. Browser support remains limited, so it is not the default target.

### Sequenced Images

Expand All @@ -52,15 +59,15 @@ substitute.
### Conversion

By default, picopt does not convert images between formats. You must turn on
conversion to PNG or WebP explicitly.
conversion to JXL, PNG or WebP explicitly.

## 🖼️ Formats

- By default picopt will optimize GIF, JPEG, PNG, and WEBP images.
- By default picopt will optimize GIF, JPEG, JXL, PNG, and WEBP images.
- Picopt can optionally optimize SVG images, ZIP, ePub, and CBZ containers.
- Picopt can convert many lossless images such as BMP, CBR, CUR, DIB, FITS, GIF,
IMT, PCX, PIXAR, PNG, PPM, PSD, QOI, SGI, SPIDER, SUN, TGA, TIFF, XBM, and XPM
into PNG and WEBP.
into JXL, PNG and WEBP.
- Picopt can convert Animated GIF, TIFF, and FLI into Animated PNG or WebP
files.
- Picopt can convert Animated GIF, TIFF, FLI, and PNG into Animated WebP files.
Expand All @@ -84,6 +91,40 @@ picopt -x BMP -c WEBP big_old.bmp

Picopt uses an internal mozjpeg python module to optimize JPEG images.

### JPEG XL

Picopt reads and writes JPEG XL with the internal
[pillow-jxl-plugin](https://github.com/Isotr0py/pillow-jpegxl-plugin) module.

Lossless JXL images are re-encoded at the highest size-targeting effort. Lossy
(XYB encoded) JXL images are left alone, as lossy WebP is.

Converting JPEG to JPEG XL is lossless and reversible: JPEG XL stores the
original JPEG bitstream, so the exact original file can be restored later.

JPEG and WebP are both formats picopt processes by default, so naming them with
`-x` cannot express a choice about them, and each has its own flag instead:

<!-- eslint-skip -->

```sh
picopt -c JXL --convert-jpeg-to-jxl --convert-webp-to-jxl photos
```

JPEG needs one because picopt otherwise never uses a lossy image as a conversion
source. WebP needs one because JPEG XL is still far less widely supported than
WebP, and converting away from a format every browser reads should be a
deliberate act. Without them, `-c JXL` converts only GIF and PNG, plus whatever
else you name with `-x`.

Two caveats on the JPEG conversion. `--strip-metadata` cannot apply to it, since
keeping the JPEG restorable means keeping all of its bytes. And picopt will not
re-optimize a JXL that carries JPEG reconstruction data, because re-encoding it
would silently discard the ability to restore the original JPEG.

Animated JPEG XL is not supported in either direction; the encoder cannot read
or write it.

### PNG & APNG

Picopt uses an internal oxipng python module to optimize PNG images and convert
Expand Down
Loading