possible bug -extent IM 6.9.0.0 Mac Snow Leopard
Posted: 2014-11-25T17:53:36-07:00
I have found some times when -extent loses or disables the alpha channel and I do not understand why.
Consider the following examples where the first and third stay transparent but the second and third become black or red. The first 3 turn the alpha off before the extent and back on afterwards. The fourth leaves the alpha channel on the whole time but uses rgba rather than rgb for the extent color
This works as expected:
convert -size 100x100 xc:none -gravity center \
-alpha off -background "rgb(255,0,0)" -extent 150x150 -alpha on tmp1.png
This turns the transparent center black (note the extent is 150x150)
convert -size 100x100 xc:white -bordercolor "gray(50)" -border 25 \
-fuzz 10% -transparent white \
-fill "rgba(255,0,0,1)" +opaque none \
-gravity center -bordercolor none -border 10x10 \
-fuzz 0 -trim +repage \
-alpha off -background "rgb(255,0,0)" -extent 150x150 -alpha on tmp2.png
This is the same as above, only the extent size is 151x151:
convert -size 100x100 xc:white -bordercolor "gray(50)" -border 25 \
-fuzz 10% -transparent white \
-fill "rgba(255,0,0,1)" +opaque none \
-gravity center -bordercolor none -border 10x10 \
-fuzz 0 -trim +repage \
-alpha off -background "rgb(255,0,0)" -extent 151x151 -alpha on tmp3.png
This turns the transparent area red (even using extent size 151x151 as above):
convert -size 100x100 xc:white -bordercolor "gray(50)" -border 25 \
-fuzz 10% -transparent white \
-fill "rgba(255,0,0,1)" +opaque none \
-gravity center -bordercolor none -border 10x10 \
-fuzz 0 -trim +repage \
-background "rgba(255,0,0,1)" -extent 151x151 tmp4.png
Seems like at least two bugs, one using -alpha off/-alpha on and the other when not turning alpha off and on.
Consider the following examples where the first and third stay transparent but the second and third become black or red. The first 3 turn the alpha off before the extent and back on afterwards. The fourth leaves the alpha channel on the whole time but uses rgba rather than rgb for the extent color
This works as expected:
convert -size 100x100 xc:none -gravity center \
-alpha off -background "rgb(255,0,0)" -extent 150x150 -alpha on tmp1.png
This turns the transparent center black (note the extent is 150x150)
convert -size 100x100 xc:white -bordercolor "gray(50)" -border 25 \
-fuzz 10% -transparent white \
-fill "rgba(255,0,0,1)" +opaque none \
-gravity center -bordercolor none -border 10x10 \
-fuzz 0 -trim +repage \
-alpha off -background "rgb(255,0,0)" -extent 150x150 -alpha on tmp2.png
This is the same as above, only the extent size is 151x151:
convert -size 100x100 xc:white -bordercolor "gray(50)" -border 25 \
-fuzz 10% -transparent white \
-fill "rgba(255,0,0,1)" +opaque none \
-gravity center -bordercolor none -border 10x10 \
-fuzz 0 -trim +repage \
-alpha off -background "rgb(255,0,0)" -extent 151x151 -alpha on tmp3.png
This turns the transparent area red (even using extent size 151x151 as above):
convert -size 100x100 xc:white -bordercolor "gray(50)" -border 25 \
-fuzz 10% -transparent white \
-fill "rgba(255,0,0,1)" +opaque none \
-gravity center -bordercolor none -border 10x10 \
-fuzz 0 -trim +repage \
-background "rgba(255,0,0,1)" -extent 151x151 tmp4.png
Seems like at least two bugs, one using -alpha off/-alpha on and the other when not turning alpha off and on.