Skip to content

Commit fecd68b

Browse files
committed
Initial version
1 parent 3b489b9 commit fecd68b

File tree

2 files changed

+86
-1
lines changed

2 files changed

+86
-1
lines changed

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM ubuntu
2+
MAINTAINER Laurens Stötzel <[email protected]>
3+
4+
# Install JpegTrag
5+
RUN echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe" > /etc/apt/sources.list
6+
RUN apt-get update -y && apt-get install -y libjpeg-progs
7+
8+
RUN mkdir -p /source
9+
WORKDIR /source
10+
11+
ENTRYPOINT [ "/usr/bin/jpegtran" ]

README.md

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,75 @@
1-
# docker-jpegtran
1+
# docker-jpegprogs
2+
JPG/JPEG image optimization/manipulation via libjpeg-progs within Docker
3+
4+
## Pull image
5+
```bash
6+
$ docker pull buffcode/docker-jpegprogs
7+
```
8+
9+
## Source directory
10+
This image creates a volume at `/source`, so you can mount a local directory to this remote directory and access any
11+
file within.
12+
Please note that `jpegtran` will not overwrite the input file but output the optimized image to STDOUT. As an
13+
alternative you can use the the `-outfile <filename>` argument with the same path to overwrite the input file.
14+
15+
## Contained applications
16+
This image makes use of the `libjpeg-progs` package. As such it also other tools like `exifautotran`, `jpegexiforient`,
17+
`rdjpgcom`, `wrjpgcom`, `cjpeg` and `djpeg`.
18+
19+
## Running jpegtran
20+
```bash
21+
$ docker run buffcode/docker-jpegprogs --help
22+
usage: /usr/bin/jpegtran [switches] [inputfile]
23+
Switches (names may be abbreviated):
24+
-copy none Copy no extra markers from source file
25+
-copy comments Copy only comment markers (default)
26+
-copy all Copy all extra markers
27+
-optimize Optimize Huffman table (smaller file, but slow compression)
28+
-progressive Create progressive JPEG file
29+
Switches for modifying the image:
30+
-crop WxH+X+Y Crop to a rectangular subarea
31+
-grayscale Reduce to grayscale (omit color data)
32+
-flip [horizontal|vertical] Mirror image (left-right or top-bottom)
33+
-perfect Fail if there is non-transformable edge blocks
34+
-rotate [90|180|270] Rotate image (degrees clockwise)
35+
-transpose Transpose image
36+
-transverse Transverse transpose image
37+
-trim Drop non-transformable edge blocks
38+
Switches for advanced users:
39+
-arithmetic Use arithmetic coding
40+
-restart N Set restart interval in rows, or in blocks with B
41+
-maxmemory N Maximum memory to use (in kbytes)
42+
-outfile name Specify name for output file
43+
-verbose or -debug Emit debug output
44+
Switches for wizards:
45+
-scans file Create multi-scan JPEG per script file
46+
```
47+
48+
### Optimize a single image
49+
```bash
50+
# output to new file
51+
$ docker run -v /local-path-to-image:/source buffcode/docker-jpegprogs \
52+
-optimize -copy none image.jpg >image-optimized.jpg
53+
54+
# overwrite input file
55+
$ docker run -v /local-path-to-image:/source buffcode/docker-jpegprogs \
56+
-optimize -copy none -outfile image.jpg image.jpg
57+
```
58+
59+
### Recursivley optimize all images
60+
The following command finds all images in the current folder (`find...`), mounts it to the Docker volume (`-v ...`) and
61+
optimizes the image (`-optimize -copy none`).
62+
```bash
63+
$ find . -name "*.jpg" | \
64+
xargs -I{} docker run -v `pwd`:/source buffcode/docker-jpegprogs \
65+
-optimize -copy none -outfile {} {}
66+
```
67+
68+
### Run another tool
69+
In case you would like to run another tool than `jpegtran` eg. `exifautotran` use the following command:
70+
```bash
71+
$ docker run --entrypoint '/usr/bin/exifautotran' buffcode/docker-jpegprogs --help
72+
exifautotran [list of files]
73+
74+
Transforms Exif files so that Orientation becomes 1
75+
```

0 commit comments

Comments
 (0)