Skip to main content

CLI tool to convert almost any image to optimized JPEGs.Fast.

Project description

Convert images to optimized JPEGs. Fast.


pypi pythonver build cov wheel downloads license

ProperJPG is a super fast, lightweight CLI app that converts and compress images to optimized jpg.If you like, it can also resize them!

If you need a tool to batch convert and optimize images making them “ready for the web”, this may be the tool for you.

It works by accepting almost all image formats and converting them to JPEG, while compressing and stripping metadata in the process.

ProperJPG allows you to set a max width/height so any images that crosses the threshold is atuomatically resized while keeping the correct aspect ratio.

It also allows you to input a folder with multiple images. In this case, ProperJPG clones the original folder structure in the output path.

Actively soliciting contributors!

Feel free to open a pull request in case you find an issue or a way to improve the app. New features are also welcome, considering they don’t add unecessary complexity to the user experience.

Installation

Regular

Pipx (recommended)

pipx install properjpg

Pip

pip install properjpg

Developer

Poetry

poetry add properjpg

Git

git clone https://github.com/vitorrloureiro/properjpg

Features

Smart resize

It has a super cool ‘smart resize’ functionality. It allows you to set a max width and height, and you can be sure that every image compressed by it will be no larger or taller than what you specify. This ‘smart resize’ mode makes sure to don’t resize images that doesn’t need to, and also takes in account if it’s best for an image to be resized based on it’s width or height.

Progressive JPG

Images are saved as progressive JPEG as default. You can disable this behaviour with -np flag. Learn more here

Multiprocessing

This app uses the multiprocessing module to leverage all the power on your computer. It’ll work faster if you have multiple cores.

How does it work?

This app works in two modes:

“Single file” mode

Input an image path and the desired output path.

Basic usage:

properjpg [input_path] [output_path] -wi=[max_width] -he=[max_height]

“Directory” mode

This is where this app really shines. Input a directory path and a desired destination path and the app will clone the folder struct of the original directory on the output path. Then it will look for all images in the input folder and will try to convert (and resize, if you setted it to) them.

ProperJPG uses multiprocessing to speed up the process.

Basic usage:

properjpg [input_path] [output_path] -d -wi=[max_width] -he=[max_height]

Commands

-h

Shows the help screen.

-d

Turns on directory mode.

-o

If set, the encoder will make an extra pass in order to select optimal encoder settings.

-q

If set, the input will be compressed to the set value (using Pillow library). Choose a value from 1 to 95.

-np

If set, disables progressive jpeg and saves as baseline instead.

-wi

Sets the max width.

-he

Sets the max height.

-re

Turns on “reduce” mode and set the factore to which the images are to be resized.

-v

Shows ProperJPG’s version.

Notes

This software is in Alpha stage. A lot of things may change, including syntax and dependencies. I’m looking for help to improve this tool in terms of speed, features and code readability. Feel free to make suggestions and improvements!. Also feel free to help me improve the tests 😅

The goal is to always keep the code with 100% test coverage.

Contributing

Requirements

This repository automatically lints code with flake8 and black, and also runs mypy and pytest. Pull requests must pass in all those tests.

Roadmap

  • Improve UI (maybe switch to Click? Add Colorama?).
  • Improve testing.

  • Improve Docs.

  • Improve Performance.

Known Issues

Client

  • None

Dev

  • 100% coverage, but tests are a mess.

  • Improve GitHub Action.

  • Create a workflow for poetry publish --build

License

MIT

Project details


Download files

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

Source Distribution

properjpg-0.3.6.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

properjpg-0.3.6-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file properjpg-0.3.6.tar.gz.

File metadata

  • Download URL: properjpg-0.3.6.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Darwin/23.5.0

File hashes

Hashes for properjpg-0.3.6.tar.gz
Algorithm Hash digest
SHA256 e70765a37f70279e2257e16b71caa575d48940da26890ce621b8f70fb4f632da
MD5 ab99411c54e0e1b36ecc9e18f778e5f9
BLAKE2b-256 6a0da8d06f88cc8b126560b69ea2f0fe81939f7e359c56621e8799fba72b7688

See more details on using hashes here.

File details

Details for the file properjpg-0.3.6-py3-none-any.whl.

File metadata

  • Download URL: properjpg-0.3.6-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Darwin/23.5.0

File hashes

Hashes for properjpg-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 037570ae97ba5edd88c5063f70a7e2ab435644c6a1a5784126fc22264724cdbe
MD5 8302b67332b6d5370edc1e55639ee627
BLAKE2b-256 e70286c26f73ce319e17654ddec5cb83b21c618507945e2be2de5c5a60a2f6d9

See more details on using hashes here.

Supported by

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