List of file formats: Difference between revisions

Jump to navigation Jump to search
m
→‎convert: Space fixes for copy and pasting.
m (→‎convert: Syntax highlight.)
m (→‎convert: Space fixes for copy and pasting.)
Line 36: Line 36:


<syntaxhighlight lang="sh">
<syntaxhighlight lang="sh">
$ convert foo.png foo.sgi      # RIGHT
$ convert foo.png foo.sgi      # RIGHT
$ convert foo.png sgi:foo.rgb  # RIGHT
$ convert foo.png sgi:foo.rgb  # RIGHT
$ convert foo.png foo.rgb      # WRONG! This doesn't create an SGI image!
$ convert foo.png foo.rgb      # WRONG! This doesn't create an SGI image!
</syntaxhighlight>
</syntaxhighlight>


Line 46: Line 46:


<syntaxhighlight lang="sh">
<syntaxhighlight lang="sh">
#!/bin/sh
#!/bin/sh
for PNG in $(find -name '*.png')
for PNG in $(find -name '*.png')
  do
  do
  SUBDIR=$(dirname $PNG)
  SUBDIR=$(dirname $PNG)
  FILEBASE=$(echo $PNG |awk -F / '{s=$(NF); n=split(s, sa, "."); delete sa[n];  for(sk in sa) {printf("%s.",sa[sk])}}')
  FILEBASE=$(echo $PNG |awk -F / '{s=$(NF); n=split(s, sa, "."); delete sa[n];  for(sk in sa) {printf("%s.",sa[sk])}}')
  RGB="$SUBDIR/${FILEBASE}rgb"
  RGB="$SUBDIR/${FILEBASE}rgb"
  if [ ! -f $RGB ]
  if [ ! -f $RGB ]
      then
      then
      convert $PNG sgi:$RGB
      convert $PNG sgi:$RGB
  fi
  fi
done
done
</syntaxhighlight>
</syntaxhighlight>


Navigation menu