What would impressionnists do with R ?
By romain francois on Friday, November 12 2010, 13:18 - Permalink
I've been playing with images recently, probably inspired from my trip in San Francisco. There was an exhibit at the De Young museum of fine arts with pieces borrowed from the Musée d'Orsay. I did not go to the exhibit because it is easy enough for me to just go to Paris and the Musée d'Orsay, but I guess this somewhat inspired me, along with the golden gate bridge, to do some R based impressionnism
The starting point is this picture of the golden gate bridge

The png package makes it straightforward to import png pictures into R (There are other ways as well).
Then, I generate randomly spaced circles so that they don't overlap, and fill each circle with the average color (on the RGB space) of all te pixels that are inside the circle
![]() |
![]() |
![]() |
![]() |
Then I do this many times, with translucent circles, and after some iterations ,the golden gate bridge starts to reveal itself

The code for this is included below
Here are other examples
Comments
It doesn´t work with R 12. in Windows...or am I wrong?
Hi,
What do you mean by "it does not work" ? I certainly have run this on R 2.12.0, albeit on OSX. What error do you get.
There was the omission of loading both the grid and png package before the rest of the code, maybe this is related to it :
Romain
But it´s the problem. Look at the result:
> require( png )
Carregando pacotes exigidos: png
Failed with error: ‘package 'png' is not installed for 'arch=x64'’
And I downloaded it from your page and installed as a zip file. Anyway, thanks for the lines.
Ah. Maybe the binary on rforge was not prepared for multi-arch version of R.
Can you try to un-install "png" and then install it from CRAN.
Otherwise, please report this to Simon Urbanek, who is the maintainer of "png".
Romain
Thanks, Romain. But, yes, it´s not working (the problem of the multi-arch...). Anyway, when it´s ready I will have fun with your code
.
Let´s wait for the new version of png...
Many thanks for your time and attention.
Looks fantastic, Romain! Thanks for sharing.
Part of me thinks that this is awesome and maybe an R package of art features would be great. The other part of me thinks that in general it would probably be easier just to create an interface to the GIMP. Either way, this is a neat trick. Thanks.
Perhaps. Feel free to get started with RGimp or GimpR.
Maybe something that allows to run R scripts within gimp, the same way you can (I think) run python and perl scripts to massage an image. See the plugin example : http://www.gimp.org/docs/scheme_plu...
No reason we should not be able to plug in Rcpp/RInside into the mix
Romain