Page 1 of 1
From photo to drawing (result is not really good)
Posted: 2018-05-01T03:02:25-07:00
by libo
Hi all,
I'm trying to convert a photo to a drawing with ImageMagick.
The result is good but still not as the result I obtain in photoshop.
At this url
http://supercolored.com/ you can find:
- the result using photoshop and the steps i followed
- the result using ImageMagick and the script I'm useing
Is there a way to close the ImageMagick result to the Photoshop result?
I'm trying many different ways but without results.
Thank you
Re: From photo to drawing (result is not really good)
Posted: 2018-05-01T04:36:00-07:00
by snibgo
libo wrote:-colorspace gray -separate -average
When an image is grayscale, separating the channels and taking their average won't change anything. (Because if you have three numbers that are the same, taking their average makes the same number.)
The Photoshop version is taking the minimum of two images. What images?
You have an edge detector, but the IM version uses a large blur.
This Windows BAT script gives a very similar result:
Code: Select all
convert ^
castle.jpg ^
-colorspace gray -colorspace sRGB +write mpr:GR ^
( -clone 0 -negate -blur 0x2 ) ^
-compose ColorDodge -composite ^
-auto-level ^
-evaluate Pow 2.4 ^
( mpr:GR +level 80%%,120%% ) ^
-compose Darken -composite -colorspace sRGB ^
out.png
Tweaking the numbers may give an even closer result.
Re: From photo to drawing (result is not really good)
Posted: 2018-05-01T05:45:26-07:00
by libo
Thank you for your help.
The Photoshop version is taking the minimum of two images. What images?
It's from the first level and the duplicate level
I did a new page with:
- image on the left: photoshop result
- centered image: your proposal
- image on the right: my new script I reported in the page
http://supercolored.com/new.php
All are still far from a good result...
Re: From photo to drawing (result is not really good)
Posted: 2018-05-01T07:56:27-07:00
by snibgo
I've uploaded my result from my script to:
http://snibgo.com/imforums/castle_p2.png
![Image](http://snibgo.com/imforums/castle_p2.png)
To me, it looks more like the Photoshop version than either other version.
Re: From photo to drawing (result is not really good)
Posted: 2018-05-01T08:56:11-07:00
by libo
You are right. That is perfect.
Did you change anything to your script?
Here my image
http://supercolored.com/new.php
I removed any resize or image optimization.
The script now is just like your:
-colorspace gray -colorspace sRGB +write mpr:GR \( -clone 0 -negate -blur 0x2 \) -compose ColorDodge -composite -auto-level -evaluate Pow 2.4 \( mpr:GR +level 80%%,120%% \) -compose Darken -composite -colorspace sRGB
It could depend by the fact that I'm generating the image through php on a linux server?
Re: From photo to drawing (result is not really good)
Posted: 2018-05-01T09:27:22-07:00
by snibgo
In your version, the lines are similar to mine, but the tones are darker. This suggests the "+level" is working differently. Windows BAT scripts need the % doubled to %%. Bash doesn't, so change those to single %.
You probably don't need either "-colorspace sRGB", but they should be harmless.
What version IM do you use? I tested my script on v6.9.5-3 and (using "magick") under v7.0.7-28.
No, I didn't resize. That is probably best left until the end.
Re: From photo to drawing (result is not really good)
Posted: 2018-05-01T10:01:37-07:00
by libo
Version: ImageMagick 6.7.2-7 2017-03-22 Q16
Changed the script in this way:
-colorspace gray -colorspace sRGB +write mpr:GR \( -clone 0 -negate -blur 0x2 \) -compose ColorDodge -composite -auto-level -evaluate Pow 2.4 \( mpr:GR +level 80%,120% \) -compose Darken -composite
Result is worst in my opinion.
http://supercolored.com/new.php
Re: From photo to drawing (result is not really good)
Posted: 2018-05-01T10:22:25-07:00
by snibgo
libo wrote:6.7.2-7
That is ancient, and probably at the time when IM confused "sRGB" with "RGB". Try removing both occurrences of "-colorspace sRGB". If that doesn't help, I suggest you upgrade.
But I suggest you upgrade anyway. If you have many scripts, upgrade to the latest v6. Otherwise, upgrade to v7.
Re: From photo to drawing (result is not really good)
Posted: 2018-05-01T10:35:23-07:00
by libo
Try removing both occurrences of "-colorspace sRGB"
It works!!
About update to another version, I think it is not possible on my vpn