I am trying to reduce colors in an image and then select one color and convert the image for that color to white on black. It works fine with PNG, MIFF, but not MPC (unless I add a non-zero fuzz value).
Works:
convert logo: -depth 8 +dither -colors 24 1tmp1.png
colorArr=(`convert 1tmp1.png -unique-colors txt: | sed 's/ */ /g' | tail -n +2 | cut -d\ -f3`)
numcolors="${#colorArr[*]}"
echo "${colorArr[*]}"
echo "numcolors=$numcolors"
echo "${colorArr[10]}"
convert 1tmp1.png \
-fill black +opaque "${colorArr[10]}" -fill white -opaque "${colorArr[10]}" \
show:
Works:
convert logo: -depth 8 +dither -colors 24 1tmp1.miff
colorArr=(`convert 1tmp1.miff -unique-colors txt: | sed 's/ */ /g' | tail -n +2 | cut -d\ -f3`)
numcolors="${#colorArr[*]}"
echo "${colorArr[*]}"
echo "numcolors=$numcolors"
echo "${colorArr[10]}"
convert 1tmp1.miff \
-fill black +opaque "${colorArr[10]}" -fill white -opaque "${colorArr[10]}" \
show:
Does not Work -- result is all black:
convert logo: -depth 8 +dither -colors 24 1tmp1.mpc
colorArr=(`convert 1tmp1.mpc -unique-colors txt: | sed 's/ */ /g' | tail -n +2 | cut -d\ -f3`)
numcolors="${#colorArr[*]}"
echo "${colorArr[*]}"
echo "numcolors=$numcolors"
echo "${colorArr[10]}"
convert 1tmp1.mpc \
-fill black +opaque "${colorArr[10]}" -fill white -opaque "${colorArr[10]}" \
show:
Works, but only with -fuzz not zero:
convert logo: -depth 8 +dither -colors 24 1tmp1.mpc
colorArr=(`convert 1tmp1.mpc -unique-colors txt: | sed 's/ */ /g' | tail -n +2 | cut -d\ -f3`)
numcolors="${#colorArr[*]}"
echo "${colorArr[*]}"
echo "numcolors=$numcolors"
echo "${colorArr[10]}"
convert 1tmp1.mpc -fuzz 1% \
-fill black +opaque "${colorArr[10]}" -fill white -opaque "${colorArr[10]}" \
show:
[RESOLVED]possible bug MPC with -fill -opaque IM 6.8.7.9 Q16
Re: possible bug MPC with -fill -opaque IM 6.8.7.9 Q16 Mac O
Use
- convert logo: +dither -colors 24 -depth 8 1tmp1.mpc