Page 1 of 1
CenterGravity not working.
Posted: 2017-04-17T22:21:56-07:00
by rpatelob
Code: Select all
convert ./cylinderize_1_20264.mpc -gravity center -crop 2000x443.089+0+0 +repage ./cylinderize_1_20264.mpc
Code: Select all
MagickSetImageGravity(wand, CenterGravity);
MagickCropImage(wand, 2000, 443, 0, 0);
MagickResetImagePage(wand,"2000x443+0+0");
MagickWriteImage(wand,"Fred_single_color1_36.png");
But somehow MagickSetImageGravity isn't working.
Re: CenterGravity not working.
Posted: 2017-04-18T00:36:41-07:00
by snibgo
MagickCropImage() isn't sensitive to gravity.
Re: CenterGravity not working.
Posted: 2017-04-18T02:11:40-07:00
by rpatelob
snibgo wrote: ↑2017-04-18T00:36:41-07:00
MagickCropImage() isn't sensitive to gravity.
How can I do it then?
Re: CenterGravity not working.
Posted: 2017-04-18T02:45:21-07:00
by Bonzo
A bit of a pain but could you write some code to calculate the co ordinates for the crop?
Re: CenterGravity not working.
Posted: 2017-04-18T04:46:53-07:00
by rpatelob
Bonzo wrote: ↑2017-04-18T02:45:21-07:00
A bit of a pain but could you write some code to calculate the co ordinates for the crop?
Could you please check
http://stackoverflow.com/questions/4347 ... ot-working link? There is a source image too
Re: CenterGravity not working.
Posted: 2017-04-18T11:20:33-07:00
by snibgo
As Bonzo says, you need to calculate the x and y offsets.
To centralise the composite, the x-offset is the difference in the image widths, divided by two. Likewise for the y-offset.
Re: CenterGravity not working.
Posted: 2017-04-18T21:54:48-07:00
by rpatelob
snibgo wrote: ↑2017-04-18T11:20:33-07:00
As Bonzo says, you need to calculate the x and y offsets.
To centralise the composite, the x-offset is the difference in the image widths, divided by two. Likewise for the y-offset.
Yes, I did that as an alternate option, as gravity creates a problem. Thank you!