display: crop and save selection as a new canvas

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
porphyry5
Posts: 12
Joined: 2011-05-22T10:06:09-07:00
Authentication code: 8675308

display: crop and save selection as a new canvas

Post by porphyry5 »

Version: ImageMagick 6.9.0-5 Q16 i686 2015-02-12 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
Features: DPC HDRI Modules OpenCL OpenMP
Delegates (built-in): bzlib cairo fontconfig freetype gslib jng jp2 jpeg lcms lqr ltdl lzma pangocairo png ps rsvg tiff webp wmf x xml zlib
Linux a 3.18.6-1-ARCH #1 SMP PREEMPT Sat Feb 7 08:59:29 CET 2015 i686 GNU/Linux

I have about 50 .jpg files from which I need to select part(s) of each image and save the selections as separate files. There is nothing constant about the size or offsets of each such selection.

Using display, its menus allow one to draw a rectangle around each desired area and save just that to file, but the saved file is distorted because the image has been stretched to the size of the original file. How can I save it with its true size?

If I need to use 'convert' to do this, how can I get the dimensions of the selected rectangle from 'display'? It shows only the offsets of the selection.
porphyry5
Posts: 12
Joined: 2011-05-22T10:06:09-07:00
Authentication code: 8675308

Re: display: crop and save selection as a new canvas

Post by porphyry5 »

You can do this using

Code: Select all

display
convert ifile -crop wwwxhhh+xx+yy -repage wwwxhhh ofile
but noone in their right mind would ever choose to, its such a laborious process, manly because the display menu bar half covers the widget showing the geometry and offsets of one's selection.

You can also do it using gimp through a somewhat laborious process.

But you would choose to do so using xv, whose process is simple, direct, obvious and does just what you might expect it to, as opposed to the subject of this forum
Post Reply