1IMGP(1) User Commands IMGP(1)
2
3
4
6 imgp - Resize, rotate JPEG and PNG images.
7
9 imgp [OPTIONS] [PATH [PATH ...]]
10
12 imgp is a multiprocessing command line image resizer and rotator for
13 JPEG and PNG images.
14
15 Features
16
17 * resize by percentage or resolution
18 * rotate clockwise by specified angle
19 * adaptive resize considering orientation
20 * brute force to a resolution
21 * optimize images to save more space
22 * limit processing by minimum image size
23 * convert PNG to JPEG
24 * erase exif metadata
25 * specify output JPEG image quality
26 * force smaller to larger resize
27 * process directories recursively
28 * overwrite source image option
29
30 Adaptive mode
31
32 - If the specified and image orientations are same [(H >= V and h > v)
33 or (H < V and h < v)], the image is resized with the longer specified
34 side as reference.
35 - In case of cross orientation [(H >= V and h <= v) or (H < V and h >=
36 v)], the image is resized with the shorter specified side as reference.
37 Same as non-adaptive.
38
39 For example, if an image has a resolution of 2048x1365 and is being
40 resized to 1366x768:
41 - In regular mode (default), output image resolution will be 1152x768
42 - In adaptive mode, output image resolution will be 1366x910
43
44 Operational notes
45
46 - Multiple files and directories can be specified as source. If PATH is
47 omitted, the current directory is processed.
48 - Output image names are appended with _IMGP if '--overwrite' option is
49 not used. By default _IMGP files are not processed. Doing so may lead
50 to potential race conditions when '--overwrite' option is used.
51 - PNG files with lower target hres/vres are not converted (even if
52 '--convert' is used). Run 'imgp --convert (*.png)' separately to con‐
53 vert those.
54 - Resize and rotate are lossy operations. For additional reductions in
55 size try '--optimize' and '--eraseexif' options.
56 - Option '--optimize' is slower, the encoder makes an extra pass over
57 the image in order to select optimal encoder settings.
58 - Progressive JPEG images are saved as progressive.
59
61 -h, --help
62 Show help text and exit.
63
64 -x, --res=res
65 Output resolution in HRESxVRES or percentage.
66
67 -o, --rotate=deg
68 Rotate clockwise by a specified angle (in degrees). Negative
69 inputs rotate anti-clockwise. Rotation by 0 degree is not
70 allowed.
71
72 -a, --adapt
73 Adapt to specified resolution considering the orientation of the
74 image. Disabled by default.
75
76 -c, --convert
77 Convert PNG images to JPEG to save on space. The output image is
78 saved with '.jpg' extension.
79
80 -d, --dot
81 Include hidden files (Linux-specific). By default hidden files
82 are skipped on Linux.
83
84 -e, --eraseexif
85 Erase EXIF metadata of JPEG images. Preserved by default.
86
87 -f, --force
88 Force to the exact specified resolution. Disabled by default.
89
90 -i, --includeimgp
91 Process _IMGP files. Risky due to potential race conditions.
92
93 -k, --keep
94 Do not process if image hres or vres matches specified hres or
95 vres, or --res is 100. However, PNG images are converted to JPEG
96 if --convert option is specified and JPEG images are made pro‐
97 gressive is --progressive option is specified.
98
99 -n, --enlarge
100 Enlarge smaller images. By default smaller images are not scaled
101 if specified resolution is greater.
102
103 --nn Use nearest neighbour interpolation for PNG images instead of
104 default antialias.
105
106 -p, --optimize
107 Optimize output images using PIL library optimization algorithm.
108 Disabled by default.
109
110 --pr, --progressive
111 Save all output JPEG images as progressive, even if the source
112 is not.
113
114 -q, --quality=N
115 Save the image with a specified quality factor N (scale 1-95,
116 default 75). JPEG only.
117
118 -m, --mute
119 Do not show any operational output.
120
121 -r, --recurse
122 Recursively process sub-directories. By default only the speci‐
123 fied directory is processed. Symbolic links are ignored to avoid
124 recursive loops.
125
126 -s, --size=byte
127 Minimum size in bytes required to process an image. Acts as a
128 guard against processing low-resolution images. Default 1024
129 bytes.
130
131 -w, --overwrite
132 Overwrite the source images. By default an output image is saved
133 with _IMGP appended to the source image name.
134 NOTE: If overwrite and convert options are used together, source
135 PNG images are deleted.
136
137 -z, --debug
138 Enable debugging.
139
141 1. Convert some images and directories:
142
143 $ imgp -x 1366x768 ~/ ~/Pictures/image3.png ~/Downloads/
144 /home/testuser/image1.png
145 3840x2160 -> 1365x768
146 11104999 bytes -> 1486426 bytes
147
148 /home/testuser/image2.jpg
149 2048x1365 -> 1152x768
150 224642 bytes -> 31421 bytes
151
152 /home/testuser/Pictures/image3.png
153 1920x1080 -> 1365x768
154 2811155 bytes -> 1657474 bytes
155
156 /home/testuser/Downloads/image4
157 2048x1365 -> 1152x768
158 224642 bytes -> 31421 bytes
159
160 2. Scale an image by 75% and overwrite the source image:
161
162 $ imgp -x 75 -w ~/image.jpg
163 /home/testuser/image.jpg
164 1366x767 -> 1025x575
165 120968 bytes -> 45040 bytes
166
167 3. Rotate an image clockwise by 90 degrees:
168
169 $ imgp -o 90 ~/image.jpg
170 120968 bytes -> 72038 bytes
171
172 4. Adapt the images in the current directory to 1366x1000 resolution.
173 Visit all directories recursively, overwrite source images, ignore
174 images with matching hres or vres but convert PNG images to JPEG.
175
176 $ imgp -x 1366x1000 -wrack
177
178 5. Set hres=800 and adapt vres maintaining the ratio.
179
180 $ imgp -x 800x0
181 Source omitted. Processing current directory...
182
183 ./image1.jpg
184 1366x911 -> 800x534
185 69022 bytes -> 35123 bytes
186
187 ./image2.jpg
188 1050x1400 -> 800x1067
189 458092 bytes -> 78089 bytes
190
191 6. Process images greater than 50KiB only:
192
193 $ imgp -wrackx 1366x1000 -s 51200
194
195 7. Generate thumbnail of the last modified file in the current dir:
196
197 #!/usr/bin/env sh
198
199 thumb64 ()
200 {
201 pop=$(ls -1t | head -1)
202 imgp -acx 64x64 "$pop"
203 }
204
206 Arun Prakash Jana <engineerarun@gmail.com>
207
209 https://github.com/jarun/imgp
210
212 https://github.com/jarun/imgp/issues
213
215 Copyright © 2016-2020 Arun Prakash Jana <engineerarun@gmail.com>
216
217 License GPLv3+: GNU GPL version 3 or later
218 <http://gnu.org/licenses/gpl.html>.
219 This is free software: you are free to change and redistribute it.
220 There is NO WARRANTY, to the extent permitted by law.
221
222
223
224Version 2.7 21 Dec 2019 IMGP(1)