Package: imgp
imgpWatch imgp resize a directory of images in lightning speed!imgpis 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.Powered by multiprocessing, SIMD parallelism (thanks to the Pillow-SIMD library), an intelligent adaptive algorithm, recursive operations, shell completion scripts, EXIF preservation (and more),imgpis a very flexible utility with well-documented easy to use options.imgpintends 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,imgpwill save your day. File managernnnprovides a script to batch resize images withimgp.Table of ContentsFeaturesAdaptive modePerformanceInstallationDependenciesFrom a package managerRelease packagesFrom sourceRunning standaloneShell completionUsagecmdline optionsOperational notesExamplesDevelopersFeaturesresize by percentage or resolutionrotate clockwise by specified angleadaptive resize considering orientationbrute force to a resolutionoptimize images to save more spacelimit processing by minimum image sizeconvert PNG to JPEGerase exif metadataspecify output JPEG image qualityforce smaller to larger resizeprocess directories recursivelyoverwrite source image optioncompletion scripts for bash, fish, zshminimal dependenciesAdaptive modeIf the specified and image orientations are same [(H >= V and h > v) or (H < V and h < v)], the image is resized with the longer specified side as reference.In case of cross orientation [(H >= V and h <= v) or (H < V and h >= v)], the image is resized with the shorter specified side as reference. Same as non-adaptive.For example, if an image has a resolution of 2048x1365 and is being resized to 1366x768:In regular mode (default), output image resolution will be 1152x768In adaptive mode, output image resolution will be 1366x910Performanceimgpcould 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%).imgpuses Python PIL/Pillow library. Nautilus Image Converter calls theconvertutility from ImageMagick. For a comparative benchmark, headhere.InstallationDependenciesimgprequires Python 3.8 or later.To install PIL library on Ubuntu, run:$ sudo apt-get install python3-pilor, using pip3:$ sudo pip3 install pillowpillow can be replaced bypillow-simdonSIMDprocessors.From a package managerInstallimgpfrom your package manager. If the version available is dated try an alternative installation method.Packaging status (expand)Unlisted packagers:●Homebrew TAP(brew install jarun/imgp/imgp)●PyPI(pip3 install imgp)●Source Mage(cast imgp)Release packagesPackages for Arch Linux, CentOS, Debian, Fedora, openSUSE Leap and Ubuntu are available with thelatest stable release.From sourceIf you have git installed, clone this repository. Otherwise download thelatest stable releaseordevelopment version(risky).Install to default location (/usr/local):$ sudo make installTo remove, run:$ sudo make uninstallPREFIXis supported, in case you want to install to a different location.Running standaloneimgpis a standalone utility. From the containing directory, run:$ ./imgpShell completionShell completion scripts for Bash, Fish and Zsh can be found in respective subdirectories ofauto-completion/. Please refer to your shell's manual for installation instructions.Usagecmdline optionsusage: imgp [-h] [-x res] [-o deg] [-a] [-c] [-e] [-f] [-H] [-i] [-k] [-m] [-M res]
            [-n] [-N] [-O] [-P] [-q N] [-r] [-s byte] [-w] [-d] [PATH [PATH ...]]

Resize, rotate JPEG and PNG images.

positional arguments:
  PATH                  source file or dir [default: current dir]

optional arguments:
  -h, --help            show this help message and exit
  -x res, --res res     output resolution in HxV or percentage
  -o deg, --rotate deg  rotate clockwise by angle (in degrees)
  -a, --adapt           adapt to resolution by orientation [default: off]
  -c, --convert         convert PNG to JPG format [default: off]
  -e, --eraseexif       erase exif metadata [default: off]
  -f, --force           force to exact specified resolution [default: off]
  -H, --hidden          include hidden (dot) files [default: off]
  -i, --includeimgp     re-process _IMGP files. * RISKY: refer to docs
  -k, --keep            skip (honors -c or --pr) images matching specified
                        H or V or --res=100 [default: off]
  -m, --mute            operate silently [default: informative]
  -M res, --minres res  min resolution in HxV or percentage of --res to resize
  -n, --enlarge         enlarge smaller images [default: off]
  -N, --nearest         use nearest neighbour interpolation for PNG [default: antialias]
  -O, --optimize        optimize the output images [default: off]
  -P, --progressive     save JPEG images as progressive [default: off]
  -q N, --quality N     quality factor (N=1-95, JPEG only) [default: 75]
  -r, --recurse         process non-symbolic dirs recursively [default: off]
  -s byte, --size byte  minimum size to process an image [default: 1024]
  -w, --overwrite       overwrite source images [default: off]
  -d, --debug           enable debug logs [default: off]Operational notesMultiple files and directories can be specified as source. IfPATHis omitted, the current directory is processed.Output image names are appended with_IMGPif--overwriteoption is not used. By default_IMGPfiles are not processed. Doing so may lead to potential race conditions when--overwriteoption is used.PNG files with lower target hres/vres are not converted (even if--convertis used). Runimgp --convert (*.png)separately to convert those.Resize and rotate are lossy operations. For additional reductions in size try--optimizeand--eraseexifoptions.Option--optimizeis slower, the encoder makes an extra pass over the image in order to select optimal encoder settings.Progressive JPEG images are saved as progressive.ExamplesConvert some images and directories:$ imgp -x 1366x768 ~/ ~/Pictures/image3.png ~/Downloads/
/home/testuser/image1.png
3840x2160 -> 1365x768
11104999 bytes -> 1486426 bytes

/home/testuser/image2.jpg
2048x1365 -> 1152x768
224642 bytes -> 31421 bytes

/home/testuser/Pictures/image3.png
1920x1080 -> 1365x768
2811155 bytes -> 1657474 bytes

/home/testuser/Downloads/image4
2048x1365 -> 1152x768
224642 bytes -> 31421 bytesScale an image by 75% and overwrite the source image:$ imgp -x 75 -w ~/image.jpg
/home/testuser/image.jpg
1366x767 -> 1025x575
120968 bytes -> 45040 bytesRotate an image clockwise by 90 degrees:$ imgp -o 90  ~/image.jpg
120968 bytes -> 72038 bytesAdapt 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.$ imgp -x 1366x1000 -wrackSet hres=800 and adapt vres maintaining the ratio.$ imgp -x 800x0
Source omitted. Processing current directory...

./image1.jpg
1366x911 -> 800x534
69022 bytes -> 35123 bytes

./image2.jpg
1050x1400 -> 800x1067
458092 bytes -> 78089 bytesProcess images greater than 50KiB only:$ imgp -wrackx 1366x1000 -s 51200Generate a 64px adapative thumbnail of the last modified file in the current dir:#!/usr/bin/env sh

thumb64 ()
{
    pop=$(ls -1t | head -1)
    imgp -acx 64x64 "$pop"
}DevelopersCopyright © 2016-2023Arun Prakash JanaAnanya Jana