0

I need to log the bounding box of the selected area from an image to the command line.

This is because I will have to do this across a number of images and then compare and reuse those bounding boxes.

I'd like to be able to do something like this:

get_bounding_box.sh

and see output like this:

+100+20+1400x1000

for a selectionoffset by 100 and 20 pixels from top left, and 1400 pixels wide and 1000 tall.

I can use Preview, Photoshop or Gimp, and am comfortable with Applescript, bash.

For example, in Preview, I would be able to get the selection bounding box shown below:

Preview example

and get 188x207 (the size of the selection bounding box) plus information about the selection's offset via command line.

That way I could use that as an input to other scripts - mostly via ImageMagick.

Is there a way to do this?

  • Can you add some details about what you want to do? How is the bounding box defined, what exactly do you want to select? – nohillside Jul 16 '18 at 7:42
  • @nohillside - edited the question to provide an example. – simone Jul 16 '18 at 14:31
  • You might want to take a look at this forum post which seems to deal with the same problem and uses ImageMagick which you already have – Tom Jul 30 '18 at 19:16

You must log in to answer this question.

Browse other questions tagged .