Image gets cut off when arcing after rotating

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
Cosinity
Posts: 3
Joined: 2016-12-16T19:27:37-07:00
Authentication code: 1151

Image gets cut off when arcing after rotating

Post by Cosinity »

I'm fairly new to ImageMagick, so apologies if the solution to this is incredibly simple.

I'm trying to arc an image upwards using the command line. According to this page the way to do that is to rotate the image 180 degrees first, then arc it and rotate it back. However when I do that I get the resulting image: Image. Rotating or arcing the image alone works fine, as does rotating the image after arcing.

Does anybody have any insight into what is going wrong/how to fix it?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Image gets cut off when arcing after rotating

Post by fmw42 »

What is your input image? What is your IM version and platform, since syntax may differ. Please always provide that.

It does not say to rotate the image all the time. It depends upon what you require for your result and your input image.

This works fine for me on IM 6.9.6.8 Q16 Mac OSX

Code: Select all

convert -font Candice -pointsize 20 label:' Around the World ' -virtual-pixel Background -background SkyBlue -distort Arc 180 arc_circle_3.jpg
Cosinity
Posts: 3
Joined: 2016-12-16T19:27:37-07:00
Authentication code: 1151

Re: Image gets cut off when arcing after rotating

Post by Cosinity »

I'm running IM 7.0.3 Q16 x64 on Windows 10. I'm using the exact command on the page I linked, with the syntax altered so it works with cmd.exe (and calibri font because I don't have Candice):

Code: Select all

convert -font calibri -pointsize 20 label:"Around the World" -virtual-pixel Background -background SkyBlue -rotate 180 -distort Arc "270 180" arc_flip.jpg
Last edited by Cosinity on 2016-12-16T21:10:41-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Image gets cut off when arcing after rotating

Post by fmw42 »

If you want the -rotate 180 then add +repage after it. That works fine for me. You have to remove the virtual canvas introduced by the -rotate.

Code: Select all

im7 magick -font Candice -pointsize 20 label:' Around the World ' -rotate 180 +repage -virtual-pixel Background -background SkyBlue -distort Arc "270 180" arc_circle_3.jpg
Cosinity
Posts: 3
Joined: 2016-12-16T19:27:37-07:00
Authentication code: 1151

Re: Image gets cut off when arcing after rotating

Post by Cosinity »

That last one worked, thank you! I wasn't aware that -rotate added a virtual canvas, knowing that probably would have helped.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Image gets cut off when arcing after rotating

Post by fmw42 »

IM 7 is not as forgiving as IM 6.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Image gets cut off when arcing after rotating

Post by fmw42 »

Any function that changes shape of the input, may add a virtual canvas. Such as -rotate, -trim, -crop, etc. Best to add +repage depending upon your output format and desires and before any subsequent processing. If you do not add it, then if you get odd results, try adding it in.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Image gets cut off when arcing after rotating

Post by anthony »

Its probably because -rotate switched to using -distort underneath in IM v.6.7.3-4. It probably should do the +repage internally (before and after the internal distort) to ensure it remains a 'simple image warp'. It may be IMv6 got that change but not IMv7.

Actually I just updated the rotate examples to reflect that change (long time to do so) removing the old examples of the problems caused by using 'rotate using 3 shears' (more blury in 'stripes' across image) that it used to use.
http://www.imagemagick.org/Usage/warping/#rotate
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply