Page 1 of 1

How was this imagemagick pointillism effect created?

Posted: 2011-02-10T10:07:23-07:00
by Tagomago
Hi -

I'm seeking a way to use imagemagick to replicate pointillism, most famously practiced by the French painter George Seurat. In his painting tiny dabs of varying colors are used to create an overall image. I figure there should be some sort of pixel transformation that can do this. I've also come across an examplehttp://itunes.apple.com/us/app/seurat-p ... 33754?mt=8 - an Iphone/Ipad app that was made using Imagemagick. Any guess at how this was done?

Also, I saw a hint that maybe "Hodgepodge cellular automata" and "cyclic space" were used. I've got both imagemagick books (by Apress and packt) and have browsed online but haven't come across these techniques described for Imagemagick.

Re: How was this imagemagick pointillism effect created?

Posted: 2011-02-10T11:50:15-07:00
by fmw42
Can you be more specific about the algorithm or code.

Take a look at the -spread function http://www.imagemagick.org/script/comma ... hp?#spread

or the various dithering techniques at http://www.imagemagick.org/Usage/quantize/

Also see my scripts below: disperse, frosted, mottle, screeneffects

Re: How was this imagemagick pointillism effect created?

Posted: 2011-02-10T12:52:16-07:00
by Tagomago
In this case, I have no idea of the algorithm or code, I just see that the final result is from Imagemagick and am wondering if anyone has a guess at the code that lead to it. I search on the makers (company) website, but though the program is free the code is not provided.

I've just looked at the spread function on your wonderful site, and came across some very useful information. But I ran into a problem my own ignorance with command-line script. You have the arguments of [-s scale] [-d amount] [-c granularity] , does that mean my imput should be:

convert test.jpg -disperse 5x5x5 -test1.jpg

I'm using windows 7, so I'm not quite sure how to adapt the full script from your site. Apologies for any gross ignorance, but I really appreciate the help.

Re: How was this imagemagick pointillism effect created?

Posted: 2011-02-10T15:55:00-07:00
by fmw42
Unfortunately, my scripts are unix bash shell scripts and do not run on Windows without cygwin.

See http://www.imagemagick.org/Usage/windows/ for more information about that and about difference in running IM on Windows vs Unix

The syntax is however

convert test.jpg -disperse -s 5 -d 5 -c 5 -test1.jpg

So if you cannot use my scripts, then

Take a look at the -spread function http://www.imagemagick.org/script/comma ... hp?#spread

or the various dithering techniques at http://www.imagemagick.org/Usage/quantize/

Re: How was this imagemagick pointillism effect created?

Posted: 2011-02-10T20:34:01-07:00
by anthony
I do not believe -disperse is a "convert option"

It is a script that uses convert, not a convert command.

Re: How was this imagemagick pointillism effect created?

Posted: 2011-02-11T13:03:16-07:00
by Tagomago
Thanks for the additionally info, I'm investigating it and will hopefully report back with progress on how to create this effect.

Re: How was this imagemagick pointillism effect created?

Posted: 2011-02-11T14:22:06-07:00
by fmw42
Again I think you simply want the IM command -spread

try

convert rose: -spread 3 rose_spread3.png

then try on your images and vary the spread amount

Re: How was this imagemagick pointillism effect created?

Posted: 2011-02-11T23:20:13-07:00
by anthony
However having said that I would like to see a 'disperse' randomized distortion. It is a pattern that I have been meaning to write about in the IM Examples distortion/displacement mapping area, and I even have a place holder for it.

Some aspects have been written up, including 'cyclic animation' of the distortion map that dispersion uses.
See Random Noise Images, and the other parts that follow
http://www.imagemagick.org/Usage/canvas/#random

In some sense -spread is just one of the extreme limits of a dispersion pattern, with a 'granularity' of 0, and thus producing snow or pixel dust type dispersion pattern. Basically it is the extreme point where no blur is performed on the initial random noise map that a dispersion starts with, and as such each and every pixel become a separate 'blob'.
However adding a little granularity to the result, will make slightly larger and coarser 'dot' in your image.

I'd like to apologize for the tardiness of updates to IM examples (and IM itself). The last year has been extremely busy for me, due to work commitments, But hopefully that will relax in a few mouths time.

Re: How was this imagemagick pointillism effect created?

Posted: 2011-02-17T10:29:23-07:00
by Tagomago
Is there a bug with spread? I've tried

convert rose: -spread 3 rose_spread3.png

Result: small green square.

Convert test.jpg -spread 3 spread.png

Result: all grey image.
Those results are on both windows and Cygwin.

Re: How was this imagemagick pointillism effect created?

Posted: 2011-02-17T11:15:59-07:00
by fmw42
what version of IM? what is your test image? can you provide a link to that image?

I had no trouble on IM 6.6.7.7 Q16 Mac OSX Tiger

convert rose: -spread 3 rose_spread3.png

Image


PNG has been worked on over a number of releases. Perhaps try output fromat as jpg or gif.

Re: How was this imagemagick pointillism effect created?

Posted: 2011-02-17T12:18:58-07:00
by Tagomago
I'm working with IM 6.6.7.5

Just tried a new Image, located http://cvcl.mit.edu/hybrid/cat2.jpg

In doing that I found that the output is the average color of the image. (I got a big block of yellow for this, grey for another.) I tried different values and got the same result. This is with both png and jpg output as well.

Re: How was this imagemagick pointillism effect created?

Posted: 2011-02-17T12:37:46-07:00
by fmw42
Version: ImageMagick 6.6.7-7 2011-02-13 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features:

Mac OSX Tiger


original:
Image

convert cat2.jpg -spread 3 cat2_spread3.jpg
Image

convert cat2.jpg -spread 5 cat2_spread3.jpg
Image

convert cat2.jpg -spread 10 cat2_spread3.jpg
Image

Re: How was this imagemagick pointillism effect created?

Posted: 2011-02-17T13:12:07-07:00
by Tagomago
So strange... I just reinstalled imagemagick with the latest version, and put in your exact commands. Same result: big block of yellow.

Re: How was this imagemagick pointillism effect created?

Posted: 2011-02-17T13:40:55-07:00
by fmw42
Post your exact IM and platform configuration, exact command and your resulting image in the Bugs forum, if you think there is a bug in your version of IM for your platform.

Re: How was this imagemagick pointillism effect created?

Posted: 2011-02-28T09:40:08-07:00
by Tagomago
Now that I can use spread, I've got some attempts at this effect to show. I think it is somewhat close, but I'm wondering if anyone has thoughts on how to make it closer. Below are images/code.

First, this is a sample image of the Iphone Pointillism app that seems to have used imagemagick.

Image

Here is my sample image with no modification:

Image

And here are two results. The first is simple,

Code: Select all

convert ducks.jpg -spread 5 -paint 1 output.jpg
Image

The second is made from a translation of Fred's disperse script into windows.

Code: Select all

convert -quiet -regard-warnings ducks.jpg +repage tmp1.mpc

convert -size 600x450 xc: -seed 1 +noise Random -virtual-pixel tile -blur 0x2 -colorspace gray -contrast-stretch 0% tmp1.png

convert tmp1.png -channel R -evaluate sine 10 -channel G -evaluate cosine 10 -channel RG -separate tmp1.mpc +swap miff:- | composite - -displace 20x20 output.jpg
Image

Ignoring the the craziness with the top of that image, the bottom result looks too harsh compared to the Iphone app. I know it can be adjusted somewhat by the inputs, but the other simple spread+paint suffers from the same issue - there is no space or softness to the pixel transformation.

By space I mean that it seems like the Iphone app has larger circles of color that are overlaid on white. Or, simply put, there is white showing through. To me this seems most accurate and pleasing, becuase Suerat the painter was painting dots on white

Does anyone have any suggestions on how to get a closer result, or how to perhaps acheive the "aeriness" or lightness of the Iphone app?