any way to crop an image using multiple coordinates?
For example:
Code: Select all
14, 45
30, 67,
35, 109
34, 1150
90, 1400
..
Code: Select all
14, 45
30, 67,
35, 109
34, 1150
90, 1400
..
As you can see on the demo, with that script you can draw an area which coordinates are inserted in an input field. After submitting the form, I would use those coordinates to crop the image, since I'm interested in showing only that area in my website frontend.snibgo wrote:What do you mean "I would like to use those coordinates to crop the image"?
but in that case the area will be a square, showing parts of the image that I'm not interested in. I just want the area I selected freely.snibgo wrote:Your script could find the maximum and minimum x-coordinates, and maximum and minimum y-coordinates, and crop to those.
In this case, could I drop using Imagemagick the area different from the white color? has Imageimagick any function to do this?snibgo wrote:Or everything outside white.
Code: Select all
convert ^
in.png ^
( +clone -fill Black -colorize 100 ^
-fill White ^
-draw "polygon 208,221 208,202 198,199 201,191 218,176 229,155" ^
) ^
-alpha off ^
-compose CopyOpacity -composite ^
-trim +repage ^
out.png