Hi.. I need some help to build the proper command line code.
I have an image that have black borders, i need to select those black borders and get the selection coordinated.
here is a print screen that have such a selection: http://img137.imageshack.us/img137/9103/pic1j.png
so i just need to do that kind of selection and get the coordinates.
Thanks.
get selection coordinates
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: get selection coordinates
I don't think IM can find the coordinates of the boundary around the black and return them to you. But you can easily trim the black areas to smallest image area and/or change the black to transparent. You can even make a mask of the non-black vs black areas and use that mask to merge images.
Can you explain why you need the coordinates?
Can you explain why you need the coordinates?
Re: get selection coordinates
Hi, thanks for your reply..
I'll explain why do i need the coordinates, maybe there is a better way to do what i need.
I'm trying to build an image cropper that will crop where the red lines in that image:
http://img339.imageshack.us/img339/9673/pic2t.png
so i need to know the high and low point of the black background.
maybe you have an idea on other way i can do that?
Thanks
I'll explain why do i need the coordinates, maybe there is a better way to do what i need.
I'm trying to build an image cropper that will crop where the red lines in that image:
http://img339.imageshack.us/img339/9673/pic2t.png
so i need to know the high and low point of the black background.
maybe you have an idea on other way i can do that?
Thanks
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: get selection coordinates
-trim will crop out as much black as possible so that the non-black areas will bound the image.
convert image.png -trim result.png
see http://www.imagemagick.org/script/comma ... s.php#trim
convert image.png -trim result.png
see http://www.imagemagick.org/script/comma ... s.php#trim
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: get selection coordinates
Warning the PNG result will probably contain the trim offset information. Using +repage after -trim or -crop is recommended to remove that information unless you actually want to see what was trimmed.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/