Abstract oil paintings

Post here to shower the ImageMagick developers with praise or discuss how you could have done a better job if you developed ImageMagick. Or talk about how Photoshop is better than ImageMagick. Even complain about how no one answered your postings in the Users forum. Venting and musings welcomed here.
Post Reply
JoaCHIP
Posts: 37
Joined: 2004-12-21T04:22:18-07:00
Location: Copenhagen

Abstract oil paintings

Post by JoaCHIP »

Just to demonstrate how damn cool ImageMagick is, here's a little crazy demo I just did:

Image

Reload for more.
Last edited by JoaCHIP on 2013-12-09T05:14:41-07:00, edited 3 times in total.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Abstract oil paintings

Post by anthony »

Very nice. How about an explanation of how it was generated! :-)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
JoaCHIP
Posts: 37
Joined: 2004-12-21T04:22:18-07:00
Location: Copenhagen

Re: Abstract oil paintings

Post by JoaCHIP »

Of course. Basically I do these steps:

* Create a 2x2 pixel grey background.
* Add rough gaussian noise.
* Scale up to double size (4x4) using interpolation.
* Add more gaussian noise (but not quite as powerful.)
* Scale up to double size (8x8).
* Add even weaker gaussian noise.
* Repeat until it is slightly larger than the desired size.
* Oil paint effect.
* Crop off the outer 5-10% because of artifacts.
* Go into the HSL colorspace (this makes the next few manipulations look more cool.)
* Normalise the "hue" channel so that we get all hues.
* Normalize the "saturation" channel so that we always have both colorful and colorless areas.
* Go back to RGB colorspace.
* Despeckle and then rotate 90 degrees (I can't explain why, but it just looked nice.)

Here's the code:

Code: Select all

convert -size 64x64 xc:#707070  -resize 2x2 -evaluate Gaussian-noise 0.152 -resize 4x4 -evaluate Gaussian-noise 0.123 -resize 8x8 -evaluate Gaussian-noise 0.100 -resize 16x16 -evaluate Gaussian-noise 0.081 -resize 32x32 -evaluate Gaussian-noise 0.065 -resize 64x64 -evaluate Gaussian-noise 0.053 -resize 128x128 -evaluate Gaussian-noise 0.043 -resize 256x256 -evaluate Gaussian-noise 0.035 -paint 10 -crop 239x239+0+0 -colorspace HSL -channel lightness -normalize -channel saturation -normalize -colorspace RGB -despeckle -rotate 90 "abstract.jpg"
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Abstract oil paintings

Post by anthony »

Very interesting effect.

The first step is basically a type of plasma, or perlin noise function

note on the use of -normalize

In the latest IM (and not yet documented) is a new function -auto-level. This is essentially like -normalize but a 'perfect' normalize, without 'histogram binning', or 'clipping' effects. that is it does a -level on the exact maximum and minimum values found in the image.

You may also like to try -auto-gamma which tries to apply a relatively simplistic mid-tone gamma adjustment function. That is it finds the 'mean value' and tries to apply a calculated gamma adjustment that would make any 'mean' color in the image, 50% gray. It works well for general photos that do not have too much dark/light extremes.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
JoaCHIP
Posts: 37
Joined: 2004-12-21T04:22:18-07:00
Location: Copenhagen

Re: Abstract oil paintings

Post by JoaCHIP »

Hah! Great suggestions. This sort of thing can be tweaked endlessly. I've been asked for a "desktop sized version" a few times too. I might make such a thing, but it would be an "image of the day" sort of thing, in order to not stress the server too much. :wink:
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Abstract oil paintings

Post by anthony »

The 'plasma' generator that is built into IM is also a very specific perlin noise generator (though only with fixed settings). Unfortunately their is a known bug somewhere deep in the algorithm that causes it to generate some top-left to bottom-right diagonal artefacts. Your solution is a nice variant.

See Plasma Random Canvases
http://www.imagemagick.org/Usage/canvas/#plasma

You may also like to look at the table of 'randomized background effects' in
http://www.imagemagick.org/Usage/backgrounds/
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
rossdv8
Posts: 47
Joined: 2014-03-12T21:54:20-07:00
Authentication code: 6789

Re: Abstract oil paintings

Post by rossdv8 »

It is amazing what can be found on this site. I know this is an old post (5 years ago) and I have absolutely no interest in abtract art, but I couldn't help testing JoaCHIP's method and code.

64x64 was a little small for me, but I found changing a few numbers is all it takes to make it generate whatever size image you want.

Alternatively resizing the output image after it is produced or adding -resize to a final smallish image makes even more interesting effects, particularly in size of what I suppose could be loosely regarded as brush strokes.

The modified code below will output really pretty 1024x768 wallpaper of around 200Kb size. A quick look at this and the original code above will show that there are only three lots of numbers that actually need to be changed. Two really, but I found changing the first -size from 64x64 gave me some interesting stuff. Then the last -resize and finally the -crop.

I have never come across the same output image twice, so it seems it really is abstract in a random sense.

convert -size 192x256 xc:#707070 -resize 4x4 -evaluate Gaussian-noise 0.152 -resize 8x8 -evaluate Gaussian-noise 0.123 -resize 16x16 -evaluate Gaussian-noise 0.100 -resize 32x32 -evaluate Gaussian-noise 0.081 -resize 64x64 -evaluate Gaussian-noise 0.065 -resize 128x128 -evaluate Gaussian-noise 0.053 -resize 256x256 -evaluate Gaussian-noise 0.043 -resize 790x1050 -evaluate Gaussian-noise 0.035 -paint 10 -crop 768x1024+0+0 -colorspace HSL -channel lightness -normalize -channel saturation -normalize -colorspace RGB -despeckle -rotate 90 abstract.jpg

Thanks JoaCHIP, for providing a heap of fun!

Cheers,

RossD.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Abstract oil paintings

Post by fmw42 »

You may be able to reproduce the same image by adding -seed and keeping the same seed value. But you may want to have different fixed seeds for each different addition of noise.

See http://www.imagemagick.org/script/comma ... s.php#seed
Post Reply