How was this imagemagick pointillism effect created?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Tagomago
Posts: 36
Joined: 2011-02-10T09:55:33-07:00
Authentication code: 8675308

How was this imagemagick pointillism effect created?

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How was this imagemagick pointillism effect created?

Post 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
Tagomago
Posts: 36
Joined: 2011-02-10T09:55:33-07:00
Authentication code: 8675308

Re: How was this imagemagick pointillism effect created?

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How was this imagemagick pointillism effect created?

Post 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/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How was this imagemagick pointillism effect created?

Post by anthony »

I do not believe -disperse is a "convert option"

It is a script that uses convert, not a convert command.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Tagomago
Posts: 36
Joined: 2011-02-10T09:55:33-07:00
Authentication code: 8675308

Re: How was this imagemagick pointillism effect created?

Post by Tagomago »

Thanks for the additionally info, I'm investigating it and will hopefully report back with progress on how to create this effect.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How was this imagemagick pointillism effect created?

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How was this imagemagick pointillism effect created?

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Tagomago
Posts: 36
Joined: 2011-02-10T09:55:33-07:00
Authentication code: 8675308

Re: How was this imagemagick pointillism effect created?

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How was this imagemagick pointillism effect created?

Post 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.
Tagomago
Posts: 36
Joined: 2011-02-10T09:55:33-07:00
Authentication code: 8675308

Re: How was this imagemagick pointillism effect created?

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How was this imagemagick pointillism effect created?

Post 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
Tagomago
Posts: 36
Joined: 2011-02-10T09:55:33-07:00
Authentication code: 8675308

Re: How was this imagemagick pointillism effect created?

Post by Tagomago »

So strange... I just reinstalled imagemagick with the latest version, and put in your exact commands. Same result: big block of yellow.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How was this imagemagick pointillism effect created?

Post 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.
Tagomago
Posts: 36
Joined: 2011-02-10T09:55:33-07:00
Authentication code: 8675308

Re: How was this imagemagick pointillism effect created?

Post 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?
Post Reply