Page 1 of 1

drawing the complex shapes in imagemagick

Posted: 2019-03-22T06:24:05-07:00
by atf4_solace
Hello Team,
We are using the Version: ImageMagick 6.9.3-8 Q16 x86_64 2018-06-20 and Platform is LINUX and API is PHP using exec() function.

We are working on drawing shapes in ImageMagick.

For drawing B shape we have used below command and shape is completely dynamic based on database settings

Code: Select all

-draw ' polyline 0,0 533.3,0 bezier 533.3,0 666.7,173.3 533.3,346.7 polyline 533.3,346.7 400,346.7 400,453.3 533.3,453.3 bezier 533.3,453.3 666.7,613.3 533.3,800 polyline 533.3,800 0,800 0,0 ' 
For example, we tried with the B shape as shown in the screenshot below

http://prntscr.com/n1gei0

But the shape is not closing properly and the black triangle is coming inside shape that means B is not drawing properly and does not have the backgeound image all over the shape
So, could you please suggest the solution to solve this problem as well please suggest to draw the shape with a curve in shapes

Thank You

Re: drawing the complex shapes in imagemagick

Posted: 2019-03-22T07:33:39-07:00
by snibgo
I'm not sure what you want.

The first polyline has only two points so merely draws a straight line.
The second polyline draws a rectangle.
The third polyline draws a large triangle.
If that's not what you want, then what do you want?

Re: drawing the complex shapes in imagemagick

Posted: 2019-03-26T02:02:23-07:00
by atf4_solace
Thanks for the reply Snibgo.

We just wanted to crop an Image in particular shape and shape is completely dynamic means we store the shape data in the database and we wanted to crop image based on that database data.

The shape is not just made from straight lines and it also includes curves in it.
For example, I wanted to crop the image in B shape so B shape is having two curves in it and others are straight lines.

So can we do such shape cropping on the image in one draw command and compose option and it will be based on database
Again some processing is done on that cropped B shape image and below is the screenshot of the cropped image.

the screenshot shows the B is not correctly cropped with our solution and that is the concern

http://prntscr.com/n1gei0

Thank You

Re: drawing the complex shapes in imagemagick

Posted: 2019-03-26T08:06:26-07:00
by snibgo
IM is drawing the shapes that you have asked for.

The shapes together don't look to me like a letter "B".

I suggest you take a sheet of graph paper. Draw the shape you want on it. Divide that shape into rectangles and curves. This will give you the coordinates of the corners of the rectangles etc.