Hi Guys,
I have a many large images like the attached.
http://postimg.org/image/yv52hpk0r/
Each Large Image has multiple (1~5) smaller images (sometimes of different size) pasted. All I need to do is extract those smaller images into separate image files, without any white borders is preferred. Can this be done with ImageMagick? & if so how?
I have been playing with fuzz & trim but doesnt seem to have much effect.
Example:
convert Lge_Image.jpg -fuzz 70% -trim +repage +adjoin Sml_Image_%d.jpg
Thank you in advance,
Arpeggio
Extract Multiple Smaller Images from a Large Image.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Extract Multiple Smaller Images from a Large Image.
Fred may have a script for this if you use bash.
Trim it, scale to one column, and find the groups of near-white pixels. This gives you the y-coordinates of the positions to crop. After cropping, trim each image.
The file is JPG, so the white areas may not be exctly white.
Trim it, scale to one column, and find the groups of near-white pixels. This gives you the y-coordinates of the positions to crop. After cropping, trim each image.
The file is JPG, so the white areas may not be exctly white.
snibgo's IM pages: im.snibgo.com
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Extract Multiple Smaller Images from a Large Image.
Another method, that can be used when the white borders don't cross the entire input image so we can't make simple guillotine cuts:
Turn everything non-white into black, so each subimage is a black rectangle, on a general white background. Use "-connected components" to find them. This directly gives us the crop parameters for the individual pictures.
Turn everything non-white into black, so each subimage is a black rectangle, on a general white background. Use "-connected components" to find them. This directly gives us the crop parameters for the individual pictures.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Extract Multiple Smaller Images from a Large Image.
I do not understand the problem given that link. I have a script for unix systems (Linux, Mac OSX and Windows with Cygwin) called multicrop. See my link below.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Extract Multiple Smaller Images from a Large Image.
I suppose he wants to chop the single linked image into three images. Using a "-connected-components" technique, we get these three:
snibgo's IM pages: im.snibgo.com