Re: Flatten or merge removes image. Help!!
Posted: 2011-05-23T20:34:07-07:00
About the code...
You draw a black line on transparency. No problem. But then you blur the line but blur the line ONLY USING ALPHA. That means while the line is blurred, The color channels are not. As such any nearby transparency now becomes semi-transparent. However transparent color is technically undefined! As such you now have a blurred line surrounded by a undefined semi-transparent color, which you then modify!
See the effects of this in...
http://www.imagemagick.org/Usage/blur/#blur_internals
Now it so happens I know the transparency color is black. So the result would be a blurred black line. But you should NOT be relying on that fact! Finally you use -auto-level (everything is black so that does nothing), and the use +level-color to color that black though the operation is really for a black to white gradient of colors. You get the wanted result, but only by accident!
Basically it is just not thought out, step-by-step. Here is the right solution!
Note that the auto-level is now restricted to just alpha channel. You don't want to change the color, just the transparency levels.
Note that I specifically turn off 'fill color'. That was the cause of your original problem.
See IM Examples, Draw Primitives, Arc
http://www.imagemagick.org/Usage/draw/#primitive_arc
Note the areas that were given a white color! That is the area given a fill color.
NOTE you can specify fill stroke and stroke-width settings (using the appropriate MVG equivalents) inside the draw string. This will limit those settings to just that draw string only.
Code: Select all
-stroke black ... -channel A -blur 0x2 +channel -auto-level +level-colors "#24acff,white"
See the effects of this in...
http://www.imagemagick.org/Usage/blur/#blur_internals
Now it so happens I know the transparency color is black. So the result would be a blurred black line. But you should NOT be relying on that fact! Finally you use -auto-level (everything is black so that does nothing), and the use +level-color to color that black though the operation is really for a black to white gradient of colors. You get the wanted result, but only by accident!
Basically it is just not thought out, step-by-step. Here is the right solution!
Code: Select all
\( -clone 0 -stroke "#24acff" -fill none -strokewidth 3 -draw "arc 10,10 130,130 80,102" \
-channel RGBA -blur 0x2 -channel A -auto-level +channel -write arc2.png \) \
Note that I specifically turn off 'fill color'. That was the cause of your original problem.
See IM Examples, Draw Primitives, Arc
http://www.imagemagick.org/Usage/draw/#primitive_arc
Note the areas that were given a white color! That is the area given a fill color.
NOTE you can specify fill stroke and stroke-width settings (using the appropriate MVG equivalents) inside the draw string. This will limit those settings to just that draw string only.