Watercolor effects: How to do these steps in IM

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
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

Watercolor effects: How to do these steps in IM

Post by dognose »

This guy details the Water color effect:

http://www.state-of-entropy.com/watercolor.html

Image

to

Image

How possible are those steps? I can do the color reduction and textures, but the smoothing and edge detection doesn't seem to be the same in IM.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

Sounds like it isn't sharpen as -adaptive-sharpen
Also remember their are tow types of sharpen -sharpen and -unsharp each using different algorithms.

Anyone with more info pleas email me so I can add it to the IM examples pages. This is one area I have practically nothing on.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

Your reference is very interesting. When you work out the final method can you please email it to either here or to me.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

Post by dognose »

Yeah, I was able to get close on another on of his examples, the sketch effect.

His sketching example: http://www.state-of-entropy.com/sketching.htm

My IM output

Image

Code: Select all

 convert source.gif -fx intenstiy bw.gif
 convert -size 100x100 xc: -fx 'rand()' -motion-blur 0x20+135 -charcoal 1 charcoal.gif
 convert -size 50x50 charcoal.gif pencil.gif
 composite -compose color_dodge pencil.gif bw.gif rough.gif 
 composite -blend 80x20 rough.gif bw.gif output.gif
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

Good job, but your commands don't work as given..

The third command for example just copies charcoal.gif to pencil.gif.

I have tried to replicate your success on the IM examples page (curtisy) of your name), but it looks like you did a number of steps that was not listed.

See http://www.cit.gu.edu.au/~anthony/graph ... k6/photos/

This is a new page, that has a large number of things yet to be added.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

When the sketch effect you generated is applied to the horse the overall image looks right but the colors do not seem to match. In the original tutorial the horse is brown and yellow as expected but with your command the horse is predominately green. Any way to fix the problem? If you can get sketching working properly we can code it as a command line option -sketch.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

I don't think a commanline option is needed, too many things users may like to change for their own use. Photoshop doesn't encode it for the same reasons.

What mat be needed is better handling of some of the more primative operators.

For example -fx intensity is slow. but -type greyscale is a input setting
and -colorspace seems to be a half operator half setting. Another hold out from IMv5 I think. If you try to use it, it stuffs later operators up.
That is where things are needed, more formal definition of what these things do.

For example for some reason the -charcoal produces a color pattern rather than black and white in some situations when I try to compond the IM code into a single command!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

Post by dognose »

Opps, the 3rd on need a resize.

I made the pencil image bigger so there less repeat.

I don't know how your horse is ending up green.

I just keep the pencil template around, so I'm not generating it all the time ( the more intensive operation)

If you don't use -fx intensity, you end up with a color sketch.

Code: Select all

 convert source.gif -fx intenstiy bw.gif
 convert -size 1000x1000 xc: -fx 'rand()' -motion-blur 0x20+135 -charcoal 1 charcoal.gif
 convert -resize 500x500 charcoal.gif pencil.gif
 composite -compose color_dodge pencil.gif bw.gif rough.gif
 composite -blend 80x20 rough.gif bw.gif output.gif 
putting it into a single command sound better though. I wish I was better at combining them, but I usually just end up with a lot of intermediate images to look at ;-)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

We added -sketch in 6.2.8-6. It should be available within a few days. Try
  • convert horse.jpg -sketch 0x20+135 sketch.jpg
Add -type gray to get a grayscale pencil sketch.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

I have updated the 'photo' IM examples page.

Though again I do not think a dedicated -sketch operator is needed as thier are a lot of variables that users may need to control, line thikness, pencil image overlay size, using tiling for the overlay,
color changes, strok direction, etc etc etc.

It is far better to add a cookbook recipe, than a dedicated IM operator for this type of thing, and there are hundred's if not thousands of variations. That is way photoshop done not do this type of thing.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

You are correct of course but sketch was added as an option to quickly produce a sketch for those that do not want to fuss with the different parameters and for the ImageMagick Studio web interface that do not have the convenience of the command line (mostly MSN TV users).
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

Getting back to the Original Program.

While what has been done (good work by the way) is great, their is still
the matter of adding the pencil outlines of the areas. Eg inserting a little edge detection into the final mix.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

Post by dognose »

Oh, thank you for adding the -sketch, I think it goes well with -paint and -charcoal. I do wish there was a better way to package up these recipes.. like with plug-ins or scripting or something. Till then, I'm fine with whatever you guys can do.

For the Original sketch recipe, yes, there did need to be a better edge. To me, -edge doesn't work right. -edge 1 will trace a pixel outside of what should be the actual edge. And, -edge 0 will do what -edge 1 does.

Is there a better way to get the edge command or other command to trace the contour lines of the image? Or, do you see a way to get the outline effect he has in the example?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

You are right about edge being slightly on one side of the actual edge.

If you want the edge on the other side you can negate the image then edge it.

I don't think thier is any other choice as a color change is a 0 width, unless you
edge it at a higher resolution.

I pointed out this edge detail in...
http://www.cit.gu.edu.au/~anthony/graph ... form/#edge

And actually rely on it to generate some interesting mottling effect
on the IM example backgrounds page...
http://www.cit.gu.edu.au/~anthony/graph ... nds/#blobs

Basically edge only currently draws in areas that are more that 50% white.

Hmmm one alturnative, use -shade with a 90 degree asmith (any direction) EG: -shade 0x90
You may need to brighten the image before appling. However it will tend to generate a 3 pixel wide edge, so maybe a higher resolution is needed.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply