0

I have a screenshot with buttons in them:

enter image description here

EDIT: I changed the image as the previous one produced an expected result.

The height of each button is 48px (44px is the actual button, 4px is the bottom spacing). How can I:

  1. trim the screenshot
  2. split it vertically
  3. trim the resulting image

I would like to be able to do all that in a single command.

This is what I tried for the 2. step:

convert -crop x48 +repage screenshot.png button%01d.png

But the first button was for some reason cropped at 37px, shifting all the other screenshots, so I ended up with screenshots of 2 parts of 2 different buttons.

Why wasn't it cropped at 48px?

silvenon
  • 2,068
  • 15
  • 29

1 Answers1

1

EDIT for the new image:

The image above has defined

$ exiftool-5.12 -a -u Flip9.png |grep -i offset
Image Offset                    : 17, 11 (pixels)

so you should use the next command for correctly setup the position of 1st page

convert -crop x48 -page +0+0 +repage Flip9.png menu%02d.png

With the above command you will got correct 9 images, like this one

enter image description here

more about the image offset here: http://www.libpng.org/pub/png/book/chapter11.html#png.ch11.div.10

clt60
  • 62,119
  • 17
  • 107
  • 194
  • Whoa... You're right, everything works as expected with that image. I've been trying to reproduce the error, but I can't, so I attached the original image instead of the previous one. Try now, it should produce the result I described. – silvenon May 07 '13 at 15:59