{"id":13419635,"url":"https://github.com/jarun/imgp","last_synced_at":"2025-04-12T20:36:23.103Z","repository":{"id":41534479,"uuid":"65226893","full_name":"jarun/imgp","owner":"jarun","description":":camera_flash: Fast batch image resizer and rotator","archived":false,"fork":false,"pushed_at":"2025-04-05T13:07:38.000Z","size":443,"stargazers_count":1067,"open_issues_count":2,"forks_count":52,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-04-05T19:02:16.461Z","etag":null,"topics":["cli","command-line","console","image-compression","image-manipulation","image-optimization","image-processing","image-resize","image-resizer","image-resolution","image-rotate","multiprocessing","standalone","terminal"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jarun.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"jarun"}},"created_at":"2016-08-08T18:00:59.000Z","updated_at":"2025-04-05T13:07:42.000Z","dependencies_parsed_at":"2022-08-10T02:40:58.139Z","dependency_job_id":"6ab3c2d0-27a0-4fda-a1ce-06d8d0b7c56c","html_url":"https://github.com/jarun/imgp","commit_stats":{"total_commits":269,"total_committers":9,"mean_commits":29.88888888888889,"dds":0.137546468401487,"last_synced_commit":"9de12ea9cfd3514d7f7b877eb983f40c697b1c1f"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarun%2Fimgp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarun%2Fimgp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarun%2Fimgp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarun%2Fimgp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jarun","download_url":"https://codeload.github.com/jarun/imgp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631225,"owners_count":21136550,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","command-line","console","image-compression","image-manipulation","image-optimization","image-processing","image-resize","image-resizer","image-resolution","image-rotate","multiprocessing","standalone","terminal"],"created_at":"2024-07-30T22:01:18.718Z","updated_at":"2025-04-12T20:36:23.072Z","avatar_url":"https://github.com/jarun.png","language":"Python","readme":"\u003ch1 align=\"center\"\u003eimgp\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/jarun/imgp/releases/latest\"\u003e\u003cimg src=\"https://img.shields.io/github/release/jarun/imgp.svg?maxAge=600\" alt=\"Latest release\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://repology.org/project/imgp/versions\"\u003e\u003cimg src=\"https://repology.org/badge/tiny-repos/imgp.svg?header=repos\" alt=\"Availability\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/imgp/\"\u003e\u003cimg src=\"https://img.shields.io/pypi/v/imgp.svg?maxAge=600\" alt=\"PyPI\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://circleci.com/gh/jarun/workflows/imgp\"\u003e\u003cimg src=\"https://img.shields.io/circleci/project/github/jarun/imgp.svg\" alt=\"Build Status\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/jarun/imgp/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-GPLv3+-yellowgreen.svg?maxAge=2592000\" alt=\"License\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://asciinema.org/a/88448\"\u003e\u003cimg src=\"https://asciinema.org/a/88448.svg\" alt=\"imgp_asciicast\" width=\"600\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003ci\u003eWatch imgp resize a directory of images in lightning speed!\u003c/i\u003e\u003c/p\u003e\n\n`imgp` is a command line image resizer and rotator for JPEG and PNG images. It can resize (or thumbnail) and rotate thousands of images in a go, at lightning speed, while saving significantly on storage.\n\nPowered by multiprocessing, SIMD parallelism (thanks to the Pillow-SIMD library), an intelligent adaptive algorithm, recursive operations, shell completion scripts, EXIF preservation (and more), `imgp` is a very flexible utility with well-documented easy to use options.\n\n`imgp` intends to be a stronger replacement of the Nautilus Image Converter extension, not tied to any file manager and way faster. On desktop environments (like Xfce or LxQt) which do not integrate Nautilus, `imgp` will save your day. File manager [nnn](https://github.com/jarun/nnn) provides a script to batch resize images with `imgp`.\n\n### Table of Contents\n\n- [Features](#features)\n  - [Adaptive mode](#adaptive-mode)\n- [Performance](#performance)\n- [Installation](#installation)\n  - [Dependencies](#dependencies)\n  - [From a package manager](#from-a-package-manager)\n  - [Release packages](#release-packages)\n  - [From source](#from-source)\n  - [Running standalone](#running-standalone)\n- [Shell completion](#shell-completion)\n- [Usage](#usage)\n  - [cmdline options](#cmdline-options)\n  - [Operational notes](#operational-notes)\n- [Examples](#examples)\n- [Troubleshooting](#troubleshooting)\n- [Developers](#developers)\n\n### Features\n\n- resize by percentage or resolution or megapixel target\n- rotate clockwise by specified angle\n- adaptive resize considering orientation\n- brute force to a resolution\n- optimize images to save more space\n- limit processing by minimum image size\n- convert PNG to JPEG\n- erase exif metadata\n- specify output JPEG image quality\n- force smaller to larger resize\n- process directories recursively\n- overwrite source image option\n- completion scripts for bash, fish, zsh\n- minimal dependencies\n\n#### Adaptive mode\n\n- If the specified and image orientations are same [(H \u003e= V and h \u003e v) or (H \u003c V and h \u003c v)], the image is resized with the longer specified side as reference.\n- In case of cross orientation [(H \u003e= V and h \u003c= v) or (H \u003c V and h \u003e= v)], the image is resized with the shorter specified side as reference. Same as non-adaptive.\n\nFor example, if an image has a resolution of 2048x1365 and is being resized to 1366x768:\n\n- In regular mode (default), output image resolution will be 1152x768\n- In adaptive mode, output image resolution will be 1366x910\n\n### Performance\n\n`imgp` could resize 8823 images (approx. 4.5GB in size) of mixed resolutions (high to regular) stored in a USB 2.0 external hard disk at an adaptive resolution of 1366x1000 in around 8 minutes. The resulting size was 897MB (approx. 20%).\n\n`imgp` uses Python PIL/Pillow library. Nautilus Image Converter calls the `convert` utility from ImageMagick. For a comparative benchmark, head [here](https://github.com/uploadcare/pillow-simd#benchmarks).\n\n### Installation\n\n#### Dependencies\n\n`imgp` requires Python 3.8 or later.\n\nTo install PIL library on Ubuntu, run:\n\n    sudo apt-get install python3-pil\n\nor, using pip3:\n\n    sudo pip3 install pillow\n\npillow can be replaced by [pillow-simd](https://github.com/uploadcare/pillow-simd) on [SIMD](https://en.wikipedia.org/wiki/SIMD) processors.\n\n#### From a package manager\n\nInstall `imgp` from your package manager. If the version available is dated try an alternative installation method.\n\n\u003cdetails\u003e\u003csummary\u003ePackaging status (expand)\u003c/summary\u003e\n\u003cp\u003e\n\u003cbr\u003e\n\u003ca href=\"https://repology.org/project/imgp/versions\"\u003e\u003cimg src=\"https://repology.org/badge/vertical-allrepos/imgp.svg\" alt=\"Packaging status\"\u003e\u003c/a\u003e\n\u003c/p\u003e\nUnlisted packagers:\n\u003cp\u003e\n\u003cbr\u003e\n● \u003ca href=\"https://github.com/jarun/homebrew-imgp\"\u003eHomebrew TAP\u003c/a\u003e (\u003ccode\u003ebrew install jarun/imgp/imgp\u003c/code\u003e)\u003cbr\u003e\n● \u003ca href=\"https://pypi.org/project/imgp/\"\u003ePyPI\u003c/a\u003e (\u003ccode\u003epip3 install imgp\u003c/code\u003e)\u003cbr\u003e\n● \u003ca href=\"http://codex.sourcemage.org/test/graphics/imgp/\"\u003eSource Mage\u003c/a\u003e (\u003ccode\u003ecast imgp\u003c/code\u003e)\u003cbr\u003e\n\u003c/p\u003e\n\u003c/details\u003e\n\n#### Release packages\n\nPackages for Arch Linux, CentOS, Debian, Fedora, openSUSE Leap and Ubuntu are available with the [latest stable release](https://github.com/jarun/imgp/releases/latest).\n\n#### From source\n\nIf you have git installed, clone this repository. Otherwise download the [latest stable release](https://github.com/jarun/imgp/releases/latest) or [development version](https://github.com/jarun/imgp/archive/master.zip) (*risky*).\n\nInstall to default location (`/usr/local`):\n\n    sudo make install\n\nTo remove, run:\n\n    sudo make uninstall\n\n`PREFIX` is supported, in case you want to install to a different location.\n\n#### Running standalone\n\n`imgp` is a standalone utility. From the containing directory, run:\n\n    ./imgp\n\n### Shell completion\n\nShell completion scripts for Bash, Fish and Zsh can be found in respective subdirectories of [auto-completion/](https://github.com/jarun/imgp/blob/master/auto-completion). Please refer to your shell's manual for installation instructions.\n\n### Usage\n\n#### cmdline options\n\n```\nusage: imgp [-h] [-x res] [-o deg] [-a] [-c] [-e] [-f] [-H] [-i] [-k] [-m] [-M res]\n            [-n] [-N] [-O] [-P] [-q N] [-r] [-s byte] [-w] [-d] [PATH [PATH ...]]\n\nResize, rotate JPEG and PNG images.\n\npositional arguments:\n  PATH                  source file or dir [default: current dir]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -x res, --res res     output resolution in HxV or percentage (\"%\" suffix) or megapixel (\"MP\" suffix)\n  -o deg, --rotate deg  rotate clockwise by angle (in degrees)\n  -a, --adapt           adapt to resolution by orientation [default: off]\n  -c, --convert         convert PNG to JPG format [default: off]\n  -e, --eraseexif       erase exif metadata [default: off]\n  -f, --force           force to exact specified resolution [default: off]\n  -H, --hidden          include hidden (dot) files [default: off]\n  -i, --includeimgp     re-process _IMGP files. * RISKY: refer to docs\n  -k, --keep            skip (honors -c or --pr) images matching specified\n                        H or V or --res=100 [default: off]\n  -m, --mute            operate silently [default: informative]\n  -M res, --minres res  min resolution in HxV or percentage of --res to resize\n  -n, --enlarge         enlarge smaller images [default: off]\n  -N, --nearest         use nearest neighbour interpolation for PNG [default: antialias]\n  -O, --optimize        optimize the output images [default: off]\n  -P, --progressive     save JPEG images as progressive [default: off]\n  -q N, --quality N     quality factor (N=1-95, JPEG only) [default: 75]\n  -r, --recurse         process non-symbolic dirs recursively [default: off]\n  -s byte, --size byte  minimum size to process an image [default: 1024]\n  -w, --overwrite       overwrite source images [default: off]\n  -d, --debug           enable debug logs [default: off]\n```\n\n#### Operational notes\n\n- Multiple files and directories can be specified as source. If `PATH` is omitted, the current directory is processed.\n- Output image names are appended with **_IMGP** if `--overwrite` option is not used. By default *_IMGP* files are not processed. Doing so may lead to potential race conditions when `--overwrite` option is used.\n- PNG files with lower target hres/vres are not converted (even if `--convert` is used). Run `imgp --convert (*.png)` separately to convert those.\n- Resize and rotate are lossy operations. For additional reductions in size try `--optimize` and `--eraseexif` options.\n- Option `--optimize` is slower, the encoder makes an extra pass over the image in order to select optimal encoder settings.\n- Progressive JPEG images are saved as progressive.\n\n### Examples\n\n1. Convert some images and directories:\n\n       $ imgp -x 1366x768 ~/ ~/Pictures/image3.png ~/Downloads/\n       /home/testuser/image1.png\n       3840x2160 -\u003e 1365x768\n       11104999 bytes -\u003e 1486426 bytes\n\n       /home/testuser/image2.jpg\n       2048x1365 -\u003e 1152x768\n       224642 bytes -\u003e 31421 bytes\n\n       /home/testuser/Pictures/image3.png\n       1920x1080 -\u003e 1365x768\n       2811155 bytes -\u003e 1657474 bytes\n\n       /home/testuser/Downloads/image4\n       2048x1365 -\u003e 1152x768\n       224642 bytes -\u003e 31421 bytes\n\n2. Scale an image by 75% and overwrite the source image:\n\n       $ imgp -x 75 -w ~/image.jpg\n       /home/testuser/image.jpg\n       1366x767 -\u003e 1025x575\n       120968 bytes -\u003e 45040 bytes\n\n3. Ensure all images in folder `testphotos/` (contains 4 images) are 12MP at maximum:\n\n       $ imgp --res 12MP -w testphotos/\n       testphotos/20250111_193949_ILCE-7M3.jpg\n       6000x4000 -\u003e 4243x2828\n       8355840 bytes -\u003e 3545149 bytes\n\n4. Rotate an image clockwise by 90 degrees:\n\n       $ imgp -o 90 ~/image.jpg\n       120968 bytes -\u003e 72038 bytes\n\n5. Adapt the images in the current directory to 1366x1000 resolution. Visit all directories recursively, overwrite source images, ignore images with matching hres or vres but convert PNG images to JPEG.\n\n       $ imgp -x 1366x1000 -wrack\n\n6. Set hres=800 and adapt vres maintaining the ratio.\n\n       $ imgp -x 800x0\n       Source omitted. Processing current directory...\n\n       ./image1.jpg\n       1366x911 -\u003e 800x534\n       69022 bytes -\u003e 35123 bytes\n\n       ./image2.jpg\n       1050x1400 -\u003e 800x1067\n       458092 bytes -\u003e 78089 bytes\n\n7. Process images greater than 50KiB only:\n\n       $ imgp -wrackx 1366x1000 -s 51200\n\n8. Generate a 64px adaptive thumbnail of the last modified file in the current dir:\n\n       #!/usr/bin/env sh\n\n       thumb64 ()\n       {\n           pop=$(ls -1t | head -1)\n           imgp -acx 64x64 \"$pop\"\n       }\n\n### Troubleshooting\n\n1. To lift the pixel limit (e.g. error `'PIL.Image.DecompressionBombError' when resizing large image`) for _trusted_ input files, uncomment the following line in the source code:\n\n       # Image.MAX_IMAGE_PIXELS = None\n\n### Developers\n\n1. Copyright © 2016-2025 [Arun Prakash Jana](https://github.com/jarun)\n2. [Ananya Jana](https://github.com/ananyajana)\n","funding_links":["https://github.com/sponsors/jarun"],"categories":["Python","Images","Applications","Multimedia and File Formats","Tools and Plugins","Uncategorized","\u003ca name=\"graphics\"\u003e\u003c/a\u003eGraphics"],"sub_categories":["Image Conversion","Graphics","Directory Navigation","Windows","Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjarun%2Fimgp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjarun%2Fimgp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjarun%2Fimgp/lists"}