about summary refs log tree commit diff
path: root/Completion/User/_tiff
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/User/_tiff')
-rw-r--r--Completion/User/_tiff203
1 files changed, 203 insertions, 0 deletions
diff --git a/Completion/User/_tiff b/Completion/User/_tiff
new file mode 100644
index 000000000..bbc331442
--- /dev/null
+++ b/Completion/User/_tiff
@@ -0,0 +1,203 @@
+#compdef -P (tiff*|*2tiff|pal2rgb)
+
+local pat expl ret=1
+
+if [[ "$words[1]" = *2tiff ]]; then
+  pat="*.(#i)${words[1]%%2tiff}"
+else
+  pat="*.(#i)tiff"
+fi
+
+if [[ $# -ne 0 || $+_in_tiff -ne 0 ]]; then
+  if (( ! $# )); then
+    _description expl 'picture file'
+    set -- "$expl[@]"
+  fi
+  _path_files "$@" -g "$pat" || _files "$@" -g '*.(#i)tiff'
+  return
+fi
+
+local _in_tiff=yes
+
+local state line ret=1
+typeset -A options
+
+case "$words[1]" in
+tiff2bw)
+  _arguments \
+    '-c[specify compression scheme]:compression scheme:->compress' \
+    '-r[specify rows per strip]:rows per strip:' \
+    '-R[specify percentage of red channel]:percentage of red channel:' \
+    '-G[specify percentage of green channel]:percentage of green channel:' \
+    '-B[specify percentage of blue channel]:percentage of blue channel:' \
+    ':input file:_files -g \*.\(\#i\)tiff' \
+    ':output file:_files -g \*.\(\#i\)tiff' && ret=0
+  ;;
+tiff2ps)
+  _arguments \
+    '-1[generate PostScript Level I output]' \
+    '-2[generate PostScript Level II output]' \
+    '-a[generate output for all IFDs]' \
+    '-d[set initial TIFF directory]:initial TIFF directory:' \
+    '(-p)-e[generate Encapsulated PostScript]' \
+    '-o[set initial TIFF directory (file offset)]:file offset:' \
+    '(-e)-p[generate non-Encapsulated PostScript]' \
+    '-h[set page height]:page height:' \
+    '-w[set page width]:page width:' \
+    '-8[disable use of ASCII85 encoding]' \
+    '-D[print two pages per sheet]' \
+    '-O[specify output file]:output file:_files -g \*.\(\#i\)' \
+    '-s[generate output for a single image]' \
+    '-T[print pages for top edge binding]' \
+    '*:input TIFF file:_files -g \*.\(\#i\)' && ret=0
+  ;;
+tiffcmp)
+  _arguments \
+    '-l[list all differing bytes]' \
+    '-t[ignore differences in directories]' \
+    ':first input TIFF file:_files -g \*.\(\#i\)' \
+    ':second input TIFF file:_files -g \*.\(\#i\)' && ret=0
+  ;;
+tiffcp)
+  _arguments \
+    '-B[write output in bin-endian byte order]' \
+    '-c[specify compression scheme]:compression scheme:->compress' \
+    '-o[set initial TIFF directory (file offset)]:file offset:' \
+    '-p[set sample packing]:sample packing:(contig separate)' \
+    '(-t)-s[write output in strips]' \
+    '(-s)-t[write output in tiles]' \
+    '-i[ignore read errors]' \
+    '-r[specify rows per strip]:rows per strip:' \
+    '-w[specify output tile width]:output tile width:' \
+    '-l[specify output tile length]:output tile length:' \
+    '-f[specify fill order]:fill order:(lsb2msb msb2lsb)' \
+    '*:input TIFF file:_files -g \*.\(\#i\)' && ret=0
+  ;;
+tiffdither)
+  _arguments \
+    '-c[specify compression scheme]:compression scheme:->compress' \
+    '-f[specify fill order]:fill order:(lsb2msb msb2lsb)' \
+    '-r[specify rows per strip]:rows per strip:' \
+    '-t[set threshold for dithering]:dither threshold value:' \
+    ':input file:_files -g \*.\(\#i\)tiff' \
+    ':output file:_files -g \*.\(\#i\)tiff' && ret=0
+  ;;
+tiffdump)
+  _arguments \
+    '-o[set initial TIFF directory (file offset)]:file offset:' \
+    '-h[print numbers in hexadecimal]' \
+    '*:input TIFF file:_files -g \*.\(\#i\)' && ret=0
+  ;;
+tiffinfo)
+  _arguments \
+    '-c[display colormap and color/gray response curves]' \
+    '-D[read and decompress data]' \
+    '-d[print decompressed data]' \
+    '-j[display JPEG-related tags]' \
+    '-o[set initial TIFF directory (file offset)]:file offset:' \
+    '-s[display offsets and byte counts for all data strips]' \
+    '-i[ignore read errors]' \
+    '-f[force fill order]:fill order:(lsb2msb msb2lsb)' \
+    '-w[display raw data in words]' \
+    '*:input TIFF file:_files -g \*.\(\#i\)' && ret=0
+  ;;
+tiffmedian)
+  _arguments \
+    '-r[specify rows per strip]:rows per strip:' \
+    '-C[specify number of colormap entries]:number of colormap entries:' \
+    '-c[specify compression scheme]:compression scheme:->compress' \
+    '-f[use Floyd-Steinberg dithering]' \
+    ':input file:_files -g \*.\(\#i\)tiff' \
+    ':output file:_files -g \*.\(\#i\)tiff' && ret=0
+  ;;
+tiffsplit)
+  _arguments \
+    ':input file:_files -g \*.\(\#i\)tiff' \
+    ':output file prefix:' && ret=0
+  ;;
+fax2tiff)
+  _arguments \
+    '(-1 -4)-2[input is Group 3, 2d encoded]' \
+    '(-2 -4)-1[input is Group 3, 1d encoded]' \
+    '(-1 -2)-4[input is Group 4 encoded]' \
+    '(-W)-B[0 in input is black]' \
+    '(-B)-W[0 in input is white]' \
+    '(-M)-L[input is lsb-to-msb]' \
+    '(-L)-M[input is msb-to-lsb]' \
+    '-R[specify resolution]:resolution (lines per inch):' \
+    '-o[specify output file]:output file:_files -g \*.\(\#i\)' \
+    '(-f)-c[generate `classic'"'"' TIFF format]' \
+    '(-c)-f[generate TIFF Class F format]' \
+    '-m[output in msb-to-lsb order]' \
+    '-p[don'"'"'t align EOL codes]' \
+    '-s[duplicate all rows]' \
+    '-v[verbose mode]' \
+    ':FAX input file:_files -g \*.\(\#i\)\(g\[34\]\|fax\)' && ret=0
+  ;;
+gif2tiff)
+  _arguments \
+    '-r[specify rows per strip]:rows per strip:' \
+    '-c[specify compression scheme]:compression scheme:->compress' \
+    ':input GIF file:_files -g \*.\(\#i\)gif' \
+    ':output file:_files -g \*.\(\#i\)tiff' && ret=0
+  ;;
+ppm2tiff)
+  _arguments \
+    '-r[specify rows per strip]:rows per strip:' \
+    '-c[specify compression scheme]:compression scheme:->compress' \
+    '-R[specify resolution]:resolution:' \
+    ':input GIF file:_files -g \*.\(\#i\)ppm' \
+    ':output file:_files -g \*.\(\#i\)tiff' && ret=0
+  ;;
+ras2tiff)
+  _arguments \
+    '-r[specify rows per strip]:rows per strip:' \
+    '-c[specify compression scheme]:compression scheme:->compress' \
+    ':input raster image file:_files -g \*.\(\#i\)ras\(\|t\)' \
+    ':output file:_files -g \*.\(\#i\)tiff' && ret=0
+  ;;
+pal2rgb)
+  _arguments \
+    '-C[specify number of bits for colormap entries]:bits for colormap entries:(8 16)' \
+    '-p[set sample packing]:sample packing:(contig separate)' \
+    '-c[specify compression scheme]:compression scheme:->compress' \
+    '-r[specify rows per strip]:rows per strip:' \
+    ':input file:_files -g \*.\(\#i\)tiff' \
+    ':output file:_files -g \*.\(\#i\)tiff' && ret=0
+  ;;
+*)
+  _description expl 'picture file'
+  _files "$expl[@]" -g "$pat" && ret=0
+esac
+
+if [[ -n "$state" ]]; then
+  if [[ "$PREFIX" = *:* ]]; then
+    local scheme="${PREFIX%%:*}"
+
+    compset -P 1 '*:'
+
+    case "$scheme" in
+    g3)
+      _values -s : 'FAX Group 3 options' \
+        '(2d)1d[use 1D-encoding]' \
+        '(1d)2d[use 2D-encoding]' \
+	'fill[byte-align EOL codes]' && ret=0
+      ;;
+    jpeg)
+      _message 'compression quality (0-100), or `r'"'"' (output RGB)'
+      ret=0
+      ;;
+    lzw|zip)
+      _values 'LZW and deflate options' \
+        '1[without differencing]' \
+        '2[with differencing]' && ret=0
+      ;;
+    esac
+  else
+    _description expl 'compression scheme'
+    compadd "$expl[@]" - none g4 packbits && ret=0
+    compadd "$expl[@]" -qS: - lzw zip jpeg g3 && ret=0
+  fi
+fi
+
+return ret