selection of a square part of a photo or image

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?".
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: selection of a square part of a photo or image

Post by fmw42 »

denisp wrote:hello,

is it possible to select a square part (not a rectangular part) of an image using command lines?

The images will be human photos and i have to select the head and shoulders.

The square may not be the same size because photos are not taken exactly at the same distance and the photos may not be centered.

Put in other words, i need a dynamic size square who can be drag over an image to select a part of the image.

Thanks for your time.
command line mode is not visually interactive! However, in command line mode, you can select any square region you want using the syntax:

convert image.jpg[WxH+X+Y] output.jpg

or

convert image.jpg -crop WxH+X+Y\! +repage output.jpg

where W is the width of the area, H is the height of the area, where in your case W=H, and X and Y are the location of the upper left corner of the region you want relative to the upper left corner of the image.

See:

http://www.imagemagick.org/Usage/files/#read_mods
http://www.imagemagick.org/script/comma ... s.php#crop

I do not know if you can select a region interactively using the X display mode:

display image.jpg
Post Reply