Page 1 of 1

Decimal transformation, and alignment of images

Posted: 2016-03-01T00:56:32-07:00
by gabrielstuff
Hi !
We have a files which contains a series of transform and we would like to know how to use the numbers to correctly move each image associated with its transform.

The parameters use very long decimal numbers for rotate and scale. Not respecting this numbers lead to wrongly aligned elements. See parameters for information :

Code: Select all

{
            "offsetX": -19,
            "offsetY": 78,
            "angle": -0.15183675289154054,
            "scale": 0.995110034942627,
            "cropWidth": 1865,
            "cropHeight": 1112
        },
        {
            "offsetX": 31,
            "offsetY": 107,
            "angle": 357.3140563964844,
            "scale": 1.1337047815322877,
            "cropWidth": 1920,
            "cropHeight": 1168
        },
        {
            "offsetX": -12,
            "offsetY": 129,
            "angle": -1.650545597076416,
            "scale": 1.1337047815322877,
            "cropWidth": 1920,
            "cropHeight": 1165
        }
This correspond to 3 images that need to be offsetted, cropped, rotated and scaled.

Thanks for any help regarding such an accurate transformation.

Re: Decimal transformation, and alignment of images

Posted: 2016-03-01T01:33:38-07:00
by snibgo
I would use "-distort SRT". See http://www.imagemagick.org/script/comma ... hp#distort

For example, assuming you want to crop after the scale and rotate:

Code: Select all

convert in.png -distort SRT 0.995110034942627,-0.15183675289154054 -crop 1865x1112-19+78 +repage out.png