-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathgm.sh
160 lines (144 loc) · 4.18 KB
/
gm.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
_patch_help() {
$@ -help | \
sed \
-e '/^Where commands include:/,/^\s*$/ s/^\s\+\(\S\+\) - \(.*\)/ \1 \2/' \
-e '/^Where commands include:/ c\Commands:' \
}
_patch_table() {
table="$( \
_patch_table_edit_options \
'-colormap;[shared|private]' \
'-colorspace;[`_choice_colorspace`]' \
'-compose;[`_choice_compose`]' \
'-compress;[`_choice_compress`]' \
'-dispose;[`_choice_dispose`]' \
'-encoding;[`_choice_encoding`]' \
'-endian;[MSB|LSB|Native]' \
'-filter;[`_choice_filter`]' \
'-highlight-style;[Assign|Threshold|Tint|XOR]' \
'-intent;[Absolute|Perceptual|Relative|Saturation]' \
'-interlace;[None|Line|Plane|Partition]' \
'-list;[Color|Delegate|Format|Magic|Module|Resource|Type]' \
'-map;[`_choice_map`]' \
'-noise;[Uniform|Gaussian|Multiplicative|Impulse|Laplacian|Poisson|Random]' \
'-page;[`_choie_page`]' \
'-preview;[`_choice_preview`]' \
'-type;[`_choice_type`]' \
'-units;[Undefined|PixelsPerInch|PixelsPerCentimeter]' \
'-virtual-pixel;[`_choice_virtual_pixel`]' \
'-visual;[`_choice_visual`]' \
)"
if [[ "$*" == "gm" ]]; then
echo "$table" | \
_patch_table_edit_options \
';;' \
'-help;;print help' \
| \
_patch_table_edit_arguments ';;'
elif [[ "$*" == "gm mogrify" ]]; then
echo "$table" | \
_patch_table_dedup_options \
'-fill' \
else
echo "$table"
fi
}
_choice_colorspace() {
printf "%s\n" CineonLog CMYK GRAY HSL HWB OHTA RGB Rec601Luma Rec709Luma \
Rec601YCbCr Rec709YCbCr Transparent XYZ YCbCr YIQ YPbPr YUV
}
_choice_map() {
if _argc_util_has_path_prefix; then
_argc_util_comp_path
else
printf "%s\n" best default gray red green blue
fi
}
_choice_type() {
printf "%s\n" Bilevel Grayscale Palette PaletteMatte TrueColor TrueColorMatte \
ColorSeparation ColorSeparationMatte Optimize
}
_choice_visual() {
printf "%s\n" StaticGray GrayScale StaticColor PseudoColor TrueColor DirectColor default 'visual id'
}
_choice_virtual_pixel() {
cat <<-'EOF'
Constant Use the image background color.
Edge Extend the edge pixel toward infinity (default).
Mirror Mirror the image.
Tile Tile the image.
EOF
}
_choice_compress() {
printf "%s\n" None BZip Fax Group3 Group4 JPEG Lossless LZW RLE Zip LZMA \
JPEG2000 JPEG2000 JBIG JBIG2 WebP ZSTD
}
_choice_compose() {
printf "%s\n" Over In Out Atop Xor Plus Minus Add Subtract Difference Divide \
Multiply Bumpmap Copy CopyRed CopyGreen CopyBlue CopyOpacity CopyCyan \
CopyMagenta CopyYellow CopyBlack
}
_choice_dispose() {
cat <<-'EOF'
Undefined No disposal specified.
None Do not dispose between frames.
Background Overwrite the image area with the background color.
Previous Overwrite the image area with what was there prior to rendering the image.
EOF
}
_choice_encoding() {
printf "%s\n" AdobeCustom AdobeExpert AdobeStandard AppleRoman BIG5 GB2312 \
'Latin 2' None SJIScode Symbol Unicode Wansung
}
_choice_filter() {
printf "%s\n" Point Box Triangle Hermite Hanning Hamming Blackman Gaussian \
Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc
}
_choie_page() {
cat <<-'EOF'
11x17 792x1224
Ledger 1224x792
Legal 612x1008
Letter 612x792
LetterSmall 612x792
ArchE 2592x3456
ArchD 1728x2592
ArchC 1296x1728
ArchB 864x1296
ArchA 648x864
A0 2380x3368
A1 1684x2380
A2 1190x1684
A3 842x1190
A4 595x842
A4Small 595x842
A5 421x595
A6 297x421
A7 210x297
A8 148x210
A9 105x148
A10 74x105
B0 2836x4008
B1 2004x2836
B2 1418x2004
B3 1002x1418
B4 709x1002
B5 501x709
C0 2600x3677
C1 1837x2600
C2 1298x1837
C3 918x1298
C4 649x918
C5 459x649
C6 323x459
Flsa 612x936
Flse 612x936
HalfLetter 396x612
EOF
}
_choice_preview() {
printf "%\sn" Rotate Shear Roll Hue Saturation Brightness Gamma Spiff Dull \
Grayscale Quantize Despeckle ReduceNoise AddNoise Sharpen Blur Threshold \
EdgeDetect Spread Shade Raise Segment Solarize Swirl Implode Wave OilPaint \
CharcoalDrawing JPEG
}