Page 1 of 1

How to extract ngon using commandline (magick.exe)

Posted: 2019-02-17T10:23:08-07:00
by allexx
Hello! I'm on Windows/IM 7, and am looking to extract an n-gon (polygon of n vertices) from a JPG.

For example, given an image that is large enough, I want to extract an n-gon described by the vertices [ (10,10), (10,20), (70,65), (60,55) ]

This SO question answers just that using C++; is there a standard commandline equivalent (using magick.exe?) pls?

( Will post back here if I find reference + translate, myself )

Re: How to extract ngon using commandline (magick.exe)

Posted: 2019-02-17T13:00:42-07:00
by fmw42
Use the equivalent of -draw "polygon ..." to create a mask and then use the mask to make the background transparent, then trim if desired to the bounding box of the polygon region. Sorry I do not code in Windows or C++.

Re: How to extract ngon using commandline (magick.exe)

Posted: 2019-02-17T13:30:48-07:00
by allexx
Thank you, Fred! Searching for "imagemagick -draw polygon" brought up a post for exactly what I asked for:
-- this: http://www.multipole.org/discourse-serv ... hp?t=25286
-- which led to this: https://www.imagemagick.org/discourse-s ... =1&t=25228