Page 1 of 1

Arc distort

Posted: 2016-08-09T14:59:56-07:00
by spacedev
I'm having trouble reproducing one of the examples in the documentation. I have a line of text that I would like to draw in a U shape arc. I found documentation here that illustrates exactly what I am trying to do: http://www.imagemagick.org/Usage/distorts/. About two thirds of the way down, there is the following text and code sample:
If before 'arc'ing an image you rotate the input image upside-down, you can place the original 'top' of the image on the inside edge of the circle. Of course you may like to 'rotate' the result back upright again afterward, but that capability is already built into the 'Arc' distortion method.

Code: Select all

convert -font Candice -pointsize 20 label:' Around the World ' -virtual-pixel Background -background SkyBlue -rotate 180 -distort Arc '270 180'  arc_flip.jpg
This is supposed to generate the following image: Image

I am running the command through Windows' command prompt. I had to change certain characters of the code sample (apparently single ticks are not interchangeable with double-quotes on Windows) and alter the font, but I am able to run the command:

Code: Select all

"C:\Program Files\ImageMagick-7.0.2-Q16\convert.exe" -font Arial -pointsize 20 label:"Around the World" -virtual-pixel Background -background SkyBlue -rotate 180   -distort Arc "270 180"  arc_flip.png
However, I do not see the same output as described in the documentation. I get an oddly rotated image:

Image

Any ideas on what I am doing wrong?

[edit] Here's my convert.exe -version log:
C:\temp>"C:\Program Files\ImageMagick-7.0.2-Q16\convert.exe" -version
Version: ImageMagick 7.0.2-7 Q16 x64 2016-08-06 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib

Re: Arc distort

Posted: 2016-08-09T15:18:16-07:00
by fmw42
It works fine on IM 6.9.5.5 Q16 Mac OSX. But fails like yours using IM 7.0.2.7 Q16 (non-hdri) Mac OSX.

This works in IM 6:

Code: Select all

convert -font Candice -pointsize 20 label:' Around the World ' -virtual-pixel Background -background SkyBlue -rotate 180 -distort Arc '270 180'  arc_flip.jpg
But this fails in IM 7:

Code: Select all

magick -font Candice -pointsize 20 label:' Around the World ' -virtual-pixel Background -background SkyBlue -rotate 180 -distort Arc '270 180'  arc_flip.jpg
I believe it is a bug in IM 7 using -rotate 180. If I take out the rotate, it is properly centered in IM 7, but the text is backwards.

Re: Arc distort

Posted: 2016-08-09T15:23:32-07:00
by spacedev
Ahhh, thanks! I'll install some older versions and see what happens.

Re: Arc distort

Posted: 2016-08-09T15:27:08-07:00
by fmw42
It only occurs in IM 7. IM 6 is fine. I have posted a bug report on this to the Bugs forum.

Re: Arc distort

Posted: 2016-08-09T17:00:44-07:00
by fmw42
This is a workaround or possibly needed with IM 7. It seems to work by adding +repage after -rotate 180

Code: Select all

magick -font Candice -pointsize 20 label:' Around the World ' -virtual-pixel Background -background SkyBlue -rotate 180 +repage -distort Arc '270 180'  arc_flip.jpg

Re: Arc distort

Posted: 2016-08-10T07:03:39-07:00
by spacedev
I was able to get good output using IM6. A couple quirks (for me on Windows at least).

I did have to swap out the single ` ticks for " quote marks - without doing this, I got garbage output even on IM6.

I had to remove the extra space characters from " Around the World " - without doing this, only the text "Around" was included in the otherwise correctly rotated output image.

After running those edits, I was able to get good output! Looks like I'll be using IM6 for this build. :)

Thanks again, fmw42!

Re: Arc distort

Posted: 2016-08-10T09:23:29-07:00
by fmw42
See my note above about adding +repage so that it works in IM 7. I believe that windows requires double quotes in place of single quotes (they are not backtics), though I am not a Windows user and so do not know for sure.

Re: Arc distort

Posted: 2016-08-10T14:20:08-07:00
by snibgo
Yes, double-quotes for Windows. See http://www.imagemagick.org/Usage/windows/