Page 1 of 1

Arc 360 radius as function of input image w x h

Posted: 2016-02-22T04:55:18-07:00
by gubach
The general case "-distort Arc 360" generates from an image with $w_i x $h_i a circle structure
with radius $r by bending the right and left edge together; the resulting square image has the
width 2*$r. In the specific case "-distort Arc '360, 0, $r, 0'" the radius can be predefined but
is there a formula (or heuristic) that links the values $r = f($w_i , $h_i) in the
general case (it is not $r = $h one might expect if the bending is considered)?

Re: Arc 360 radius as function of input image w x h

Posted: 2016-02-22T05:11:55-07:00
by snibgo
The answer comes from a quick read of distort.c.

new_radius = cols/(2.pi) + (rows-1)/2.0

The new width and height are 2*new_radius, with a conversion to integer.

Re: Arc 360 radius as function of input image w x h

Posted: 2016-02-22T09:37:57-07:00
by gubach
thank you for answering; I am puzzling what 2.pi might be? 2*pi?
In an example I just made with Arc 360 (in: w=3740 x h=1872 out: r=1452) the term 2.pi becomes 7.241... so a bit more than 2*pi

Re: Arc 360 radius as function of input image w x h

Posted: 2016-02-22T10:27:17-07:00
by snibgo
Yes, 2 times pi where pi = 3.141...

What version IM are you using? With 6.9.2-5 I get:

Code: Select all

f:\web\im>%IM%convert -size 3740x1872 xc: -distort Arc 360 +repage info:

xc: XC 3064x3064 16-bit sRGB 11.391u 0:01.468
So r=1532.

The formula gives:

Code: Select all

f:\web\im>ccalc = 3740/(2*pi) + (1872-1)/2.0= exit

1530.739487163689
I haven't traced the code to find where 1530.739 becomes 1532.

Re: Arc 360 radius as function of input image w x h

Posted: 2016-02-22T16:08:59-07:00
by gubach
thank you for clarifying the 2*pi.

> What version IM are you using?
For some reasons I am using an old development environment with ImageMagick 6.6.2-5 2010-08-12 Q8


> I haven't traced the code to find where 1530.739 becomes 1532.
On http://www.imagemagick.org/Usage/distorts there is a hint about anti-aliasing effects:
"This creates a ring that is 100 pixels wide, though the accomidating image is 102 pixels wide to allow for anti-aliasing effects. "
so int(1530.739)+2 = 1532


Morerover I am not able to reproduce the result of Arc 360 with Arc '360 0 $r 0' were $r is derived from the first result. The appearence of the images are viewable different so I am suspecting that there are hidden variables and/or parameter settings in the code.

Re: Arc 360 radius as function of input image w x h

Posted: 2016-02-22T19:15:39-07:00
by fmw42
Just a note: your version of Imagemagick is over 300 versions old. You might consider upgrading IM.