Page 2 of 2

Re: Converting an image into blocks of colour as a lego patt

Posted: 2011-02-25T08:08:33-07:00
by mrship
Thanks again for the tips. Here's where I've got to:

Original image:

Image


Processed image:
Image

This was using a combination thus:

Code: Select all

convert -colors 25 -treedepth 8
convert +dither -remap // with a palette derived from lego colours
convert -despeckle -despeckle -despeckle -despeckle -despeckle -despeckle -despeckle -despeckle // is there a better way to achieve this?
convert -sample 512
convert -sample 256
convert -despeckle -despeckle -despeckle
./scripts/stainedglass.sh -k square -s 2 -t 0 // Fred's script
convert -sample 620
That gets pretty good results, which gives me a better place to start creating the manual grids, but it still isn't 100%. In particular, the black stripes of the tiger's face would have to be manually edited to remove the anti-aliasing that still in there.

I don't really know if I can move this further forward, but I'll see where else I can take it.

Thanks for all the help so far.

Re: Converting an image into blocks of colour as a lego patt

Posted: 2011-02-25T16:59:42-07:00
by anthony
Instead of despeckle, you could try the morphology 'intensity' functions with say a 'Square:3' kernel.
http://www.imagemagick.org/Usage/morphology/#intensity

The intensity versions do NOT create new colors. It compares using intensity and then uses that to select the while pixel color to be used as a result.

For example... This is a smooth by intensity variant.

convert rose: -morphology CloseI Square:3 -morphology OpenI Square:3 show:

Play with them :-)

I have not added a SmoothI or SmoothIntensity variant, but that could easily be added.