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

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
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

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

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

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

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

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

Post by linjuming »

understand ! thank you very much !
Post Reply