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?".
rpatelob
Posts: 62 Joined: 2017-04-17T22:17:01-07:00
Authentication code: 1151
Post
by rpatelob » 2017-04-17T22:21:56-07:00
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.
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2017-04-18T00:36:41-07:00
MagickCropImage() isn't sensitive to gravity.
rpatelob
Posts: 62 Joined: 2017-04-17T22:17:01-07:00
Authentication code: 1151
Post
by rpatelob » 2017-04-18T02:11:40-07:00
snibgo wrote: ↑ 2017-04-18T00:36:41-07:00
MagickCropImage() isn't sensitive to gravity.
How can I do it then?
Bonzo
Posts: 2971 Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England
Post
by Bonzo » 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?
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 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.
rpatelob
Posts: 62 Joined: 2017-04-17T22:17:01-07:00
Authentication code: 1151
Post
by rpatelob » 2017-04-18T21:54:48-07:00
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!