6,566
edits
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 sgi:foo.rgb # RIGHT | |||
$ 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 | |||
for PNG in $(find -name '*.png') | |||
do | |||
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])}}') | |||
RGB="$SUBDIR/${FILEBASE}rgb" | |||
if [ ! -f $RGB ] | |||
then | |||
convert $PNG sgi:$RGB | |||
fi | |||
done | |||
</syntaxhighlight> | </syntaxhighlight> | ||