Page 1 of 1
Stroke-linecap round not working
Posted: 2014-04-30T22:49:55-07:00
by bigimp
Hello!
I'm using imagemagick (Version: ImageMagick 6.8.9-0 Q16 x86_64 2014-04-30) to render some pngs. I installed IM on Ubuntu following the instructions found here:
http://www.imagemagick.org/script/insta ... e.php#unix
Though I had to redo the make and make install because I was missing libpng the first time around.
Anyway, this is the command I'm using
(6.8.9-0 Q16) convert -size 256x256 xc:white -quality 00 -depth 24 -draw "stroke-width 10 stroke '#2f7d3d' stroke-linecap round line 131,182 135,182" blah.png
and this is the resulting image:
I was expecting the line caps to be round on the left and right sides, but that doesn't seem to happen.
I had initially tried to use IM v 6.6.9-7, which is what "apt-get install" installs on Ubuntu, but I ran into another bug... I *believe* round linecaps were working with the older version (though I'm not 100% sure as I didn't do enough testing of that particular feature at the time), but if I drew a white line (using "#FFFFFF"), I would get an image that looked like this:
(6.6.9-7) convert -size 256x256 xc:white -quality 00 -depth 24 -draw "stroke-width 10 stroke '#FFFFFF' stroke-linecap round line 131,182 135,182" test.png
The linked PNGs were created by IM, so you can analyze them directly if that helps.
Any idea how I can handle either one of those issues?
Thanks very much!
Edit: stroke-linecap round bug also reproduced with 6.8.9-0 Q8, 6.8.7-10 Q8 and 6.8.0-10 Q8. Still looking for a version that works, if someone knows, please let me know!
Re: Stroke-linecap round not working
Posted: 2014-04-30T23:24:21-07:00
by fmw42
I can confirm that stroke-linecap does not seem to be working for me either on IM 6.8.9.0 Q16 Mac OSX Snow Leopard
But note that there is no such -depth 24. I think you mean PNG24:
So this is a better test case
Code: Select all
convert -size 256x256 xc:white -quality 00 \
-draw "stroke-width 50 stroke '#2f7d3d' stroke-linecap round line 128,128 128,200" PNG24:test.png
or
Code: Select all
convert -size 256x256 xc:white -quality 00 \
-draw "stroke-width 50 stroke '#2f7d3d' stroke-linecap round line 128,128 128,200" -alpha off test.png
Re: Stroke-linecap round not working
Posted: 2014-04-30T23:34:34-07:00
by bigimp
Thanks for confirmation.
-depth seems to be listed here:
http://www.imagemagick.org/script/comma ... .php#depth
and described here as well:
http://www.imagemagick.org/Usage/basics/#image_quality
Am I missing something about -depth?
Re: Stroke-linecap round not working
Posted: 2014-05-01T09:52:56-07:00
by fmw42
Yes, -depth is per channel not per image. So it is 16 or less for Q16 IM or 8 or less for Q8 IM.
Re: Stroke-linecap round not working
Posted: 2014-05-01T11:14:09-07:00
by bigimp
Ah, thanks for the explanation! I didn't even know Q16 was something I needed to look at (thought it was some internal version number, I didn't read the download page too carefully
. I only need 8 bits per pixel (for 24 bits/pixel total), so I'll try the Q8 version, which presumably runs a little more efficiently as well.
From what I understand, IM will use a 256 (or less) color palette when it's possible for an image, and use 24-bits/32-bits per pixel if the image needs a bigger palette. Is that correct? Does using PNG24 force non-palette storage? Do I even want to use any options for colors if all I want is 24-bit (or 256-color palette when possible) colors? I *will* use alpha off and maybe alpha remove, since I don't use any transparency, but I'm wondering if I even want to specify PNG24.
Thanks again fmw42!
Re: Stroke-linecap round not working
Posted: 2014-05-01T14:14:31-07:00
by fmw42
For color images, if you want 8-bit total color (palette) results, you can specify PNG8:output.png. If you have transparency PNG8: only supports binary transparency. If you want 24-bit total color (8-bits per channel), then use PNG24:. If you want 32-bits total color including 8-bit transparency use PNG32:. Other formats are controlled with -type and -color. You may use -color <256 for png or other formats, such as GIF or TIFF. JPG is always 24bits, but compressed, as I understand it.
see
http://www.imagemagick.org/Usage/formats/
Re: Stroke-linecap round not working
Posted: 2014-05-01T14:19:07-07:00
by bigimp
Thank you fmw42... ideally, I want it to detect the number of colors and decide between PNG8 and PNG24 (PNG8 if there are 256 or less colors total, PNG24 otherwise). Is there a way to do that, or is that the default behavior? (I have no transparency at all, btw, so it'll be between 8 and 24).
As for the bugs I reported, what's the typical response here? Should I wait for a response from a dev, or assume it'll be a long time before a fix and try to find a version that works or another solution?
Re: Stroke-linecap round not working
Posted: 2014-05-01T14:38:46-07:00
by fmw42
see the command -unique-colors. That will report lots of information. But the total rows (less the first) will be the number of unique colors. So you can extract that first (in a separate command) and then based upon how many colors, use that to control your output.
However, if you leave off PNGX: or use PNG:, then IM should optimize automatically to either palette (8-bits total) or (24-bits total) depending upon the input image. You should easily be able to test that.
( PNG00 was supposed to inherit from the input rather than optimizing, but a recent bug report said it was broken. )
See
Re: Stroke-linecap round not working
Posted: 2014-05-01T15:01:01-07:00
by bigimp
Awesome, thanks a ton for all your help!
Re: Stroke-linecap round not working
Posted: 2014-05-01T22:32:32-07:00
by bigimp
Stroke-linecap tests so far:
6.8.9-0 Q16 doesn't work
6.8.9-0 Q8 doesn't work
6.8.7-10 Q8 doesn't work
6.8.0-10 Q8 doesn't work
6.7.8-10 Q8 doesn't work
6.7.5-10 Q8 WORKS
Looks like it's been broken for quite a while! I guess not a commonly used feature? I tried 'path' instead of 'line' with the same results btw.
Re: Stroke-linecap round not working
Posted: 2014-05-01T23:16:21-07:00
by fmw42
It works for me at 6.7.6.0 Q16 Mac OSX, but not 6.7.9.0 and above. I can try to pin it down further tomorrow, if need be.
Re: Stroke-linecap round not working
Posted: 2014-05-02T09:55:18-07:00
by bigimp
And finally, 6.7.7-10 Q8 worked as well. So it appears it broke at some point between 6.7.7-10 and 6.7.8-10.