Page 1 of 1
Why one image gets affected better then another
Posted: 2018-04-27T00:12:37-07:00
by naive
Hello all, Firstly i have to say that I'm a avid user of Imagemagick and am very thankful for the great work that you guys are doing to support this fantastic project!
I'm working with animated gifs to transform them into sort of line drawings, and i can't understand why one of them has really strong vivid colors while the other doesnt, maybe someone can help me out?
so my process of work is the following:
1. I take a color gif
![Image](https://s9.postimg.cc/zeihakrdb/Screen_Shot_2018-04-27_at_10.05.42.png)
2. I apply this - > convert gif.gif -morphology EdgeIn Octagon edgeinoctagon.gif
3. I receive effect like this
I tried the same process on this image:
![Image](https://s9.postimg.cc/5nvcopqxb/Screen_Shot_2018-04-27_at_10.08.03.png)
and got this:
It's a similar effect but the colors are not as vivid as in the first one. I should mention that the first one is a gif of bigger size, so it probably contains more color information and less compression, but what could I do to make the second one, or any other image have the same vividness?
thanks so much for whoever can help me!
Re: Why one image gets affected better then another
Posted: 2018-04-27T01:27:37-07:00
by snibgo
naive wrote:It's a similar effect but the colors are not as vivid as in the first one.
The first input has "strong vivid colours", compared to the second. So the outputs have similar differences.
One measure of "strong vivid color" is chroma, the second channel of HCL. We can increase chroma like this (Windows BAT syntax):
Code: Select all
convert ^
Screen_Shot_2018-04-27_at_10_08_03.png ^
-colorspace HCL -channel G -evaluate Pow 0.3 +channel -colorspace sRGB ^
-morphology EdgeIn octagon ^
x.png
Re: Why one image gets affected better then another
Posted: 2018-04-27T05:46:41-07:00
by naive
Thanks Snibgo it worked really good, I experimented with different color channels and another one which was bringing the colors to the edge was HSI I'm running under Mac OS, so on LINUX the code for me was:
convert image.gif -colorspace HCL -channel G -evaluate Pow 0.3 +channel -colorspace sRGB -morphology EdgeIn Octagon HCLFSEdgeOct.gif
However now the image has so much compressions noise in black color, do you think there's a way to get rid of that?
![Image](https://s9.postimg.cc/lhwxcx07z/Screen_Shot_2018-04-27_at_15.41.08.png)
Is there a smart way to denoise the black color, or somehow to leave it unaffected?
Thanks again!
Re: Why one image gets affected better then another
Posted: 2018-04-27T07:15:16-07:00
by snibgo
You can change pixels that are near black to exactly black with "-black threshold 10%" after reading the input.
The input image Screen_Shot_2018-04-27_at_10_08_03.png has only 159 colours, probably has a result of a conversion to GIF, which can record only 256 colours. The image has dither patterns instead of smooth variations. A small blur, eg "-blur 0x1" smooths the dither away.
This also blurs edges within the image, which can be prevented by using an adaptive blur.
The best solution is to start from a better source, ie one that has not had colours reduced.
Re: Why one image gets affected better then another
Posted: 2018-04-27T07:45:06-07:00
by naive
Thanks for the patience
snibgo wrote: ↑2018-04-27T07:15:16-07:00
You can change pixels that are near black to exactly black with "-black threshold 10%" after reading the input.
By saying to apply the black-threshold after reading the input you mean smth like this? ->
convert gif.gif -black-threshold 10% -colorspace HCL -channel G -evaluate Pow 0.3 +channel -colorspace sRGB -morphology EdgeIn Octagon HCLFSEdgeOctBlack.gif
Because this just leaves me with a blank transparent image.. (I'm pasting it here, but you prob won't see it)
And regarding the conversion, what about the first normal image with the girl, does it have better compression? What's better about that one, just curious to know, for the future so i could make better gif's hehe
here's the original ->
![Image](https://s9.postimg.cc/q2wvwtvpr/gif.gif)
Re: Why one image gets affected better then another
Posted: 2018-04-27T09:22:55-07:00
by snibgo
naive wrote:By saying to apply the black-threshold after reading the input you mean smth like this?
Yes, like that. With the source you linked (Screen_Shot_2018-04-27_at_10_08_03.png) my GIF output is:
![Image](http://snibgo.com/imforums/eb_blk_thr.gif)
It has 256 colours. When I save as PNG, that has 5450 colours.
Your animated GIF of a woman in a yellow dress has major variation in the background between frames, and GIF won't compress these well. After simplifying with morphology, I would expect compression to be better.