Page 1 of 1

why can not i remove the 1px of top border ?

Posted: 2011-10-29T19:30:55-07:00
by linjuming
extending from "how to get the color value of a point (2)?"

now some problem occur.
why can not i remove the 1px of top border ?

source png:
Image

description:
Image

Re: why can not i remove the 1px of top border ?

Posted: 2011-10-29T20:13:11-07:00
by anthony
Image cropping is performed relative to the 'Page Geometry' or 'Virtual Canvas' of the image. Not to the actual image..

Code: Select all

identify -verbose kk-1.png
  ...
  Geometry: 20x128+0+0
  ...
  Page geometry: 100x131+10+1
  ...
Basically the image is not saved the way you are expecting! You missed a +repage after some crop at some point.
See http://www.imagemagick.org/Usage/crop/#crop

Try this.

Code: Select all

convert kk-1.png  +repage -crop 20x286+1+1 +repage  result.png
better still...

Code: Select all

convert kk-1.png  +repage -shave 0x1  result.png
shave works on the real image not the virtual canvas.

Re: why can not i remove the 1px of top border ?

Posted: 2011-10-29T20:42:26-07:00
by linjuming
understand ! thank you very much !