# Optimize Images [![Github commits (since latest release)](https://img.shields.io/github/commits-since/victordomingos/optimize-images/latest.svg)](https://github.com/victordomingos/optimize-images) ![PyPI](https://img.shields.io/pypi/v/optimize-images) ![PyPI - Downloads](https://img.shields.io/pypi/dm/optimize-images)
A command-line interface (CLI) utility written in pure Python to help you
reduce the file size of images.
This application is intended to be pure Python, with no special dependencies
besides Pillow, therefore ensuring compatibility with a wide range of systems,
including iPhones and iPads running Pythonista 3. If you don't have the need
for such a strict dependency management, you will probably be better served
by any several other image optimization utilities that are based on some well
known external binaries.
Some aditional features can be added which require the presence of other
third-party packages that are not written in pure Python, but those packages
and the features depending on them should be treated as optional.
![optimize-images_screenshot](https://user-images.githubusercontent.com/18650184/42172232-5788c43a-7e13-11e8-8094-5811e7fd55c1.png)
If you were just looking for the graphical user interface (GUI) version of this application, it's a separate project: [Optimize Images X](https://github.com/victordomingos/optimize-images-x).
## Full Documentation:
* [English](https://github.com/victordomingos/optimize-images/blob/master/docs/docs_EN.md)
* [Português](https://github.com/victordomingos/optimize-images/blob/master/docs/docs_PT.md)
Please refer to the above links if you want to know about all the options available in this application. For a quick intro, just to get a feeling of what it can do, please keep reading below.
## Installation and dependencies:
To install and run this application, you need to have a working
Python 3.6+ installation. We try to keep the external dependencies at a minimum,
in order to keep compatibility with different platforms, including Pythonista
on iOS. At this moment, we require:
- Pillow==8.2.0
- piexif==1.1.3
- watchdog==2.1.2
The easiest way to install it in a single step, including any dependencies, is
by using this command:
```
pip3 install pillow optimize-images
```
If you are able to swap Pillow with the faster version
[Pillow-SIMD](https://github.com/uploadcare/pillow-simd), you should be able
to get a considerably faster speed. For that reason, we provide, as a
friendly courtesy, an optional shell script (`replace_pillow__macOS.sh`) to
replace Pillow with the faster Pillow-SIMD on macOS. Please notice, however,
that it usually requires a compilation step and it was not throughly tested
by us, so your mileage may vary.
You can also use this application on iOS, using an called
[Pythonista 3](http://omz-software.com/pythonista/) (which is, among other
things, a very nice environment for developing and/or running pure Python
applications on iOS). Please check the detailed install procedure full in the
user documentation.
## How to use
The most simple form of usage is to type a simple command in the shell,
passing the path to an image or a folder containing images as an argument.
The optional `-nr` or `--no-recursion` switch argument tells the application not
to scan recursively through the subdirectories.
By default, this utility applies lossy compression to JPEG files using a
variable quality setting between 75 and 80 (by Pillow's scale), that is
dynamically determined for each image according to the amount of change caused
in its pixels, then it removes any EXIF metadata, tries to optimize each
encoder's settings for maximum space reduction and applies the maximum ZLIB
compression on PNG.
You must explicitly pass it a path to the source image file or to the
directory containing the image files to be processed. By default, it will scan
recursively through all subfolders and process any images found using the
default or user-provided settings, replacing each original file by its
processed version if its file size is smaller than the original.
If no space savings were achieved for a given file, the original version will
be kept instead.
There are many other features and command-line options, like downsizing,
keeping EXIF data, color palete reduction, PNG to JPEG conversion. Please
check the docs for further information.
**DISCLAIMER:
Please note that the operation is done DESTRUCTIVELY, by replacing the
original files with the processed ones. You definitely should duplicate the
source file or folder before using this utility, in order to be able to
recover any eventual damaged files or any resulting images that don't have the
desired quality.**
## Basic usage
Try to optimize a single image file:
```
optimize-images filename.jpg
```
Try to optimize all image files in current working directory and all of its
subdirectories:
```
optimize-images ./
```
Try to optimize all image files in current working directory, without recursion:
```
optimize-images -nr ./
```
```
optimize-images --no-recursion ./
```
## Getting help
To check the list of available options and their usage, you just need to use one of the
following commands:
```
optimize-images -h
```
```
optimize-images --help
```
## Did you find a bug or do you have a suggestion?
Please let me know, by opening a new issue or a pull request.
Raw data
{
"_id": null,
"home_page": "https://no-title.victordomingos.com/projects/optimize-images/",
"name": "optimize-images",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "python3 pythonista-ios pil pillow image-processing image-compression image-optimization image-optimisation seo seo-optimization website-performance cli recursive non-recursive",
"author": "Victor Domingos",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/d9/d4/a29188fbeaefcf0780290e2d3ec06e004d940876f1914be07631bd401c9e/optimize-images-1.5.1.tar.gz",
"platform": null,
"description": "# Optimize Images [![Github commits (since latest release)](https://img.shields.io/github/commits-since/victordomingos/optimize-images/latest.svg)](https://github.com/victordomingos/optimize-images) ![PyPI](https://img.shields.io/pypi/v/optimize-images) ![PyPI - Downloads](https://img.shields.io/pypi/dm/optimize-images)\nA command-line interface (CLI) utility written in pure Python to help you \nreduce the file size of images.\n\nThis application is intended to be pure Python, with no special dependencies\nbesides Pillow, therefore ensuring compatibility with a wide range of systems,\nincluding iPhones and iPads running Pythonista 3. If you don't have the need\nfor such a strict dependency management, you will probably be better served\nby any several other image optimization utilities that are based on some well\nknown external binaries.\n\nSome aditional features can be added which require the presence of other \nthird-party packages that are not written in pure Python, but those packages \nand the features depending on them should be treated as optional.\n\n![optimize-images_screenshot](https://user-images.githubusercontent.com/18650184/42172232-5788c43a-7e13-11e8-8094-5811e7fd55c1.png)\n\nIf you were just looking for the graphical user interface (GUI) version of this application, it's a separate project: [Optimize Images X](https://github.com/victordomingos/optimize-images-x). \n\n\n## Full Documentation:\n * [English](https://github.com/victordomingos/optimize-images/blob/master/docs/docs_EN.md)\n * [Português](https://github.com/victordomingos/optimize-images/blob/master/docs/docs_PT.md)\n\nPlease refer to the above links if you want to know about all the options available in this application. For a quick intro, just to get a feeling of what it can do, please keep reading below.\n\n## Installation and dependencies:\n\nTo install and run this application, you need to have a working\nPython 3.6+ installation. We try to keep the external dependencies at a minimum,\nin order to keep compatibility with different platforms, including Pythonista\non iOS. At this moment, we require:\n\n - Pillow==8.2.0\n - piexif==1.1.3\n - watchdog==2.1.2\n\nThe easiest way to install it in a single step, including any dependencies, is \nby using this command:\n\n```\npip3 install pillow optimize-images\n```\n\nIf you are able to swap Pillow with the faster version \n[Pillow-SIMD](https://github.com/uploadcare/pillow-simd), you should be able\nto get a considerably faster speed. For that reason, we provide, as a \nfriendly courtesy, an optional shell script (`replace_pillow__macOS.sh`) to \nreplace Pillow with the faster Pillow-SIMD on macOS. Please notice, however, \nthat it usually requires a compilation step and it was not throughly tested \nby us, so your mileage may vary.\n\nYou can also use this application on iOS, using an called\n[Pythonista 3](http://omz-software.com/pythonista/) (which is, among other\nthings, a very nice environment for developing and/or running pure Python\napplications on iOS). Please check the detailed install procedure full in the \nuser documentation.\n\n## How to use\n\nThe most simple form of usage is to type a simple command in the shell, \npassing the path to an image or a folder containing images as an argument.\nThe optional `-nr` or `--no-recursion` switch argument tells the application not \nto scan recursively through the subdirectories.\n\nBy default, this utility applies lossy compression to JPEG files using a \nvariable quality setting between 75 and 80 (by Pillow's scale), that is\ndynamically determined for each image according to the amount of change caused\nin its pixels, then it removes any EXIF metadata, tries to optimize each\nencoder's settings for maximum space reduction and applies the maximum ZLIB\ncompression on PNG.\n\nYou must explicitly pass it a path to the source image file or to the\ndirectory containing the image files to be processed. By default, it will scan \nrecursively through all subfolders and process any images found using the \ndefault or user-provided settings, replacing each original file by its \nprocessed version if its file size is smaller than the original.\n\nIf no space savings were achieved for a given file, the original version will \nbe kept instead.\n\nThere are many other features and command-line options, like downsizing, \nkeeping EXIF data, color palete reduction, PNG to JPEG conversion. Please \ncheck the docs for further information.\n\n**DISCLAIMER: \nPlease note that the operation is done DESTRUCTIVELY, by replacing the\noriginal files with the processed ones. You definitely should duplicate the\nsource file or folder before using this utility, in order to be able to\nrecover any eventual damaged files or any resulting images that don't have the\ndesired quality.**\n \n\n## Basic usage\n\nTry to optimize a single image file:\n\n```\noptimize-images filename.jpg\n```\n\n \nTry to optimize all image files in current working directory and all of its\nsubdirectories:\n\n```\noptimize-images ./\n```\n\n\nTry to optimize all image files in current working directory, without recursion:\n\n```\noptimize-images -nr ./\n```\n\n```\noptimize-images --no-recursion ./\n```\n\n\n## Getting help\n\nTo check the list of available options and their usage, you just need to use one of the \nfollowing commands:\n\n\n```\noptimize-images -h\n```\n\n```\noptimize-images --help\n```\n \n \n## Did you find a bug or do you have a suggestion?\n\nPlease let me know, by opening a new issue or a pull request.\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A command-line interface (CLI) utility written in pure Python to help you reduce the file size of images.",
"version": "1.5.1",
"split_keywords": [
"python3",
"pythonista-ios",
"pil",
"pillow",
"image-processing",
"image-compression",
"image-optimization",
"image-optimisation",
"seo",
"seo-optimization",
"website-performance",
"cli",
"recursive",
"non-recursive"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "4a09e2b79668418920ed88e5e76847a4",
"sha256": "ed82328556d9beb08edb3bbc7ed62d1b0a0f66952ee6b9d12de0285395f38f5f"
},
"downloads": -1,
"filename": "optimize_images-1.5.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4a09e2b79668418920ed88e5e76847a4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 28527,
"upload_time": "2022-04-17T23:59:14",
"upload_time_iso_8601": "2022-04-17T23:59:14.298596Z",
"url": "https://files.pythonhosted.org/packages/12/49/6d6246827ac55d9356ef53cd541f13a94928c44d0b4fff0bf32840389aba/optimize_images-1.5.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "667415a8e46010ad67a82655852d0b3d",
"sha256": "35f073d434575556398f60d19dfc9f9d6209482ebe3aa11d508205bfe25d4dc8"
},
"downloads": -1,
"filename": "optimize-images-1.5.1.tar.gz",
"has_sig": false,
"md5_digest": "667415a8e46010ad67a82655852d0b3d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 24368,
"upload_time": "2022-04-17T23:59:17",
"upload_time_iso_8601": "2022-04-17T23:59:17.147186Z",
"url": "https://files.pythonhosted.org/packages/d9/d4/a29188fbeaefcf0780290e2d3ec06e004d940876f1914be07631bd401c9e/optimize-images-1.5.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-04-17 23:59:17",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "optimize-images"
}