Arc distort

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
spacedev
Posts: 3
Joined: 2016-08-09T14:31:01-07:00
Authentication code: 1151

Arc distort

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Arc distort

Post 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.
spacedev
Posts: 3
Joined: 2016-08-09T14:31:01-07:00
Authentication code: 1151

Re: Arc distort

Post by spacedev »

Ahhh, thanks! I'll install some older versions and see what happens.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Arc distort

Post by fmw42 »

It only occurs in IM 7. IM 6 is fine. I have posted a bug report on this to the Bugs forum.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Arc distort

Post 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
spacedev
Posts: 3
Joined: 2016-08-09T14:31:01-07:00
Authentication code: 1151

Re: Arc distort

Post 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!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Arc distort

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Arc distort

Post by snibgo »

Yes, double-quotes for Windows. See http://www.imagemagick.org/Usage/windows/
snibgo's IM pages: im.snibgo.com
Post Reply