The following code works for what it does.
It takes an image and produces several images, but only works with images with a solid white background.
Code: Select all
convert B.jpg \
-fuzz 3.8% -trim +repage -write B_trim.jpg \
\
\( +clone -rotate 90 +clone -mosaic +level-colors white \) +swap -gravity center -composite -write mpr:original \
\
\( +clone -resize 300x300 +repage -write B_large.jpg +delete \) \
\( +clone -resize 150x150 +repage -write B_medium.jpg +delete \) \
\( +clone -resize 100x100 +repage -write B_small.jpg +delete \) \
\( +clone -resize 60x60 +repage -write B_tiny.jpg +delete \) \
\
\( +clone -fx 'p { 0, 0 }' \) \
\
-compose Difference -composite -modulate 100,0 -alpha off -threshold 3.8% -blur 0x1 mpr:original +swap -alpha Off -compose CopyOpacity -composite \
\
\( +clone -trim +repage -write B_original.png +delete \) \
\( +clone -trim -resize 300x300 +repage -write B_trim.png +delete \) \
\( +clone -resize 150x150 +repage -write B_medium.png +delete \) \
\( +clone -resize 100x100 +repage -write B_small.png +delete \) \
\( +clone -resize 60x60 +repage -write B_tiny.png +delete \) \
\
B_original.jpg
What I want to do is extend this to non white solid or near solid colours.
, ,
There are various ideas that come to mind. And all the automatic image manipulation output is verified by a man (he's called Steve - everyone say "Hello, Steve!").
Using -edge 1 on these images produces a nice looking mask. If there was a way to use a mask for the initial edge detection, then ... how?
I'm sure there is an easy way to do this, but I can't seem to cast the appropriate magick spell.
Any help would be really appreciated.
Regards,
Richard Quadling.