Page 1 of 1

[SOLVED] Is it possible to split an image based on border detection over a transparent background?

Posted: 2016-11-14T20:46:39-07:00
by Rubonnek
Say, for example, we have a triangle and a circle on the same file and on a transparent background. Like this:

Image

And after processing the image we get the circle in one file and the triangle in another. Like cropping but instead of specifying the tile size, the shapes get autodetected and extracted into separate files.

I'm aware something similar can be done with a script I found here, but the images I need to do this on have more than two colors.

Re: Is it possible to split an image based on border detection over a transparent background?

Posted: 2016-11-14T22:00:31-07:00
by snibgo

Code: Select all

call %PICTBAT%rectSubimages Vyl7bO4.png out.png
This creates out-0.png and out-1.png, the required images.

For the rectSubimages Windows BAT script, see my "Subimage rectangles" page.

Re: Is it possible to split an image based on border detection over a transparent background?

Posted: 2016-11-15T00:39:12-07:00
by fmw42
See my script multicrop for unix-based systems

Re: Is it possible to split an image based on border detection over a transparent background?

Posted: 2016-11-15T06:46:05-07:00
by Rubonnek
snibgo wrote:

Code: Select all

call %PICTBAT%rectSubimages Vyl7bO4.png out.png
This creates out-0.png and out-1.png, the required images.

For the rectSubimages Windows BAT script, see my "Subimage rectangles" page.
I don't currently use ImageMagick on Windows, but I'll definitely keep this in mind. Thanks a lot!
fmw42 wrote:See my script multicrop for unix-based systems
I used multicrop2 and it worked wonderfully. Thanks a lot!