table of contents
IMGP(1) | User Commands | IMGP(1) |
NAME¶
imgp - Resize, rotate JPEG and PNG images.SYNOPSIS¶
imgp [OPTIONS] [PATH [PATH ...]]DESCRIPTION¶
imgp is a multiprocessing command line image resizer and rotator for JPEG and PNG images.Features
* resize by percentage or resolution * rotate clockwise by specified angle * adaptive resize considering orientation * brute force to a resolution * optimize images to save more space * convert PNG to JPEG * erase exif metadata * force smaller to larger resize * process directories recursively * overwrite source image option
Multiple files and directories can be specified as source. If PATH is omitted, the current directory is processed.
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.
Adaptive mode
- If 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
1152x768
- In adaptive mode, output image resolution will be 1366x910
OPTIONS¶
- -h, --help
- Show help text and exit.
- -x, --res=res
- Output resolution in HRESxVRES or percentage.
- -o, --rotate=deg
- Rotate clockwise by a specified angle (in degrees). Negative inputs rotate anti-clockwise. Rotation by 0 degree is not allowed.
- -a, --adapt
- Adapt to specified resolution considering the orientation of the image. Disabled by default.
- -c, --convert
- Convert PNG images to JPEG to save on space. The output image is saved with '.jpg' extension.
- -d, --dot
- Include hidden files (Linux-specific). By default hidden files are skipped on Linux.
- -e, --eraseexif
- Erase EXIF metadata of JPEG images. Preserved by default.
- -f, --force
- Force to the exact specified resolution. Disabled by default.
- -i, --includeimgp
- Process _IMGP files. Risky due to potential race conditions.
- -k, --keep
- Do not process if image hres or vres matches specified hres or vres, or --res is 100. However, PNG images are converted to JPEG if --convert option is specified.
- -n, --enlarge
- Enlarge smaller images. By default smaller images are not scaled if specified resolution is greater.
- -p, --optimize
- Optimize output images using PIL library optimization algorithm. Disabled by default.
- -q, --quiet
- Do not show any operational output.
- -r, --recursive
- Recursively process sub-directories. By default only the specified directory is processed. Symbolic links to directories are ignored to avoid recursive loops.
- -w, --overwrite
- Overwrite the source images. By default an output image is saved with
_IMGP appended to the source image name.
NOTE: If overwrite and convert options are used together, source PNG images are deleted. - -z, --debug
- Enable debugging.
EXAMPLES¶
- 1.
- Convert 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 bytes
- 2.
- Scale an image by 75% and overwrite the source image:
-
$ imgp -x 75 -w ~/image.jpg /home/testuser/image.jpg 1366x767 -> 1025x575 120968 bytes -> 45040 bytes
- 3.
- Rotate an image clockwise by 90 degrees:
-
$ imgp -o 90 ~/image.jpg 120968 bytes -> 72038 bytes
- 4.
- 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.
-
$ imgp -x 1366x1000 -wrack
- 5.
-
Set 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 bytes
AUTHORS¶
Arun Prakash Jana <engineerarun@gmail.com>HOME¶
https://github.com/jarun/imgpREPORTING BUGS¶
https://github.com/jarun/imgp/issuesLICENSE¶
Copyright © 2016 Arun Prakash Jana <engineerarun@gmail.com>License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO
WARRANTY, to the extent permitted by law.
Oct 2016 | Version 2.2 |