Skip to main content

A multi format lossless image optimizer that uses external tools

Project description

picopt

A multi-format, recursive, multiprocessor aware, command line lossless image optimizer utility that uses external tools to do the optimizing.

Picopt depends on Python PIL to identify files and Python rarfile to open CBRs.

The actual image optimization is accomplished by external programs.

To optimize JPEG images. Picopt needs one of mozjpeg or jpegtran on the path. in order of preference.

To optimize lossless images like PNG, PNM, GIF, and BMP, picopt requires either optipng or pngout be on the path. Optipng provides the most advantage, but best results are acheived by using pngout as well.

Animated GIFs are optimized with gifsicle if it is available. Picopt nag you to convert your file to HTML5 video, but does not provide this service itself.

Picopt uncompresses, optimizes and rezips comic book archive files. Be aware that CBR rar archives will be rezipped into CBZs instead of CBR. Comic book archive optimization is not turned on by default to prevent surprises.

Picopt allows you to drop picopt timestamps at the root of your recursive optimization trees so you don't have to remember which files to optimize or when you last optimized them.

Installation

Lossless external program packages

macOS

brew install optipng mozjpeg gifsicle
ln -s /usr/local/Cellar/mozjpeg/3.1/bin/jpegtran /usr/local/bin/mozjpeg
brew install jonof/kenutils/pngout

Debian / Ubuntu

apt-get install optipng gifsicle python-imaging

if you don't want to install mozjpeg using the instructions below then use jpegtran:

apt-get install libjpeg-progs

Redhat / Fedora

yum install optipng gifsicle python-imaging

if you don't want to install mozjpeg using the instructions below then use jpegtran:

yum install libjpeg-progs

MozJPEG

mozjpeg offers better compression than libjpeg-progs' jpegtran. As of Jan 2020 it may or may not be packaged for your *nix, but even when it is, picopt requires that its separately compiled version of jpegtran be symlinked to 'mozjpeg' somewhere in the path. This installation example is for OS X:

ln -s /usr/local/Cellar/mozjpeg/3.3/bin/jpegtran /usr/local/bin/mozjpeg

You may find Linux instructions on Andrew Welch's blog

pngout

pngout is a useful compression to use after optipng. It is not packaged for linux, but you may find the latest binary version on JonoF's site. Picopt looks for the binary to be called pngout

Picopt python package

pip install picopt

Usage

Optimize all JPEG files in a dirctory:

picopt *.jpg

Optimize all files and recurse directories:

picopt -r *

Optimize files and recurse directories AND optimize comic book archives:

picopt -rc *

Optimize files, but not lossless files:

picopt -OPG *

Optimize files, but not jpegs:

picopt -JT *

Optimize files, but not animated gifs:

picopt -G *

Just list files picopt.py would try to optimize:

picopt -l *

Optimize everything in my iPhoto library, but only after the last time i did this, skipping symlinks to avoid massive amounts of duplicate work. Don't convert lossless files to PNGs because that would confuse iPhoto. Also drop a timestamp file so I don't have to remember the last time I did this:

picopt -rSYt -D '2013 June 1 14:00' 'Pictures/iPhoto Library'

Gotchas

Picopt automatically uses timestamp files if it detects them in or above the current directory tree. A situation can arise with comic archives where the comic archive itself is newer than the timestamp file so it is processed, but the files inside the archive are older than the timestamp file so they are not. Currently the workaround is to move the comic archive outside of the current tree into a temporary directory and process it there.

Packaged For

Alternatives

imagemin looks to be an all in one cli and gui solution with bundled libraries, so no awkward dependancies. Imageoptim is an all-in-one OS X GUI image optimizer. Imageoptim command line usage is possible with an external program.

The Future

Maybe someday everyone will just use AVIF and AV1 for everything and these sorts of tools will be obsolete. Or if Apple decides to support WebP it could happen even sooner.

Project details


Release history Release notifications | RSS feed

This version

2.2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

picopt-2.2.0.tar.gz (1.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

picopt-2.2.0-py3-none-any.whl (31.5 kB view details)

Uploaded Python 3

File details

Details for the file picopt-2.2.0.tar.gz.

File metadata

  • Download URL: picopt-2.2.0.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.6 Darwin/19.3.0

File hashes

Hashes for picopt-2.2.0.tar.gz
Algorithm Hash digest
SHA256 7d6d3cadbe141527f720841bb898f08c8bf15bef05317e82d4c16cc71692b169
MD5 beba0d6a420f8f9c8c90232a7af3589e
BLAKE2b-256 2f5ef97eddba36f13a2816f92df21d1fb4e5983e35a8986b2fffaa4b9589c5da

See more details on using hashes here.

File details

Details for the file picopt-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: picopt-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 31.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.6 Darwin/19.3.0

File hashes

Hashes for picopt-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e511a6cc4af982cd0e19f3d1c023efb276a736eb85c23c223383a47f751401d
MD5 e6ec75ca43ff566f40f91a22713d64df
BLAKE2b-256 0ddccdd9e03a15525983e2253a8087f1c058223b89d7c232115d7f3567da2517

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page