Gimp-Forum.net
Pure black n white with smooth curves - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: Pure black n white with smooth curves (/Thread-Pure-black-n-white-with-smooth-curves)



Pure black n white with smooth curves - ociebieda - 04-25-2018

I am already using gimp for years, not professionally, but I know most basics.
I also already used google to find proper solution, but all tutorials are not exactly about what I need, so please do not send me links about simple black n white or greyscale conversions.

What I need is to convert colored image to almost pure black n white effect with smooth curves.
I am not talking about greyscale with "desaturate" or 2 color with "threshold".

Original image in lossless PNG.
It has various colors that I want to remove, not making them greyscale.
https://speedstar.itos.pl/gimp/gimp-original.png
[Image: gimp-original.png]

Method 1.
I use "threshold" with value 160, which is close to what I am looking for, but the problem is that it makes image pure 2 color, and all curves are not smooth, making no shades between black and white pixels (use pixel perfect zoom withot blurring filters if you are not sure what I am talking about).
https://speedstar.itos.pl/gimp/gimp-threshold_160.png
[Image: gimp-threshold_160.png]

Method 2.
I use "desaturate" with "average" setting, make duplicate and set layer mode to "dodge", which keeps smooth curves and nicely removes most filling colors, but there are grey fogs that can be noticed on chest, upper leg, and shoe.
https://speedstar.itos.pl/gimp/gimp-desaturate_average_layer_dodge.png
[Image: gimp-desaturate_average_layer_dodge.png]

Method 3.
I use "desaturate" with "average" setting, increase gamma (not brightness, because I do not want to touch black color) with "levels" with value 160, increase "contrast" to value 96 (127 makes image 2 color), but I am still getting grey fogs slightly on chest and noticeably on upper leg, and also some lines become too small.
https://speedstar.itos.pl/gimp/gimp-desaturate_average_levels_160_contrast_96.png
[Image: gimp-desaturate_average_levels_160_contrast_96.png]

Method 4.
I use "color to alpha" on all colors, make duplicate and set layer mode to "dodge", which seems to to have better effect than previous methods, but I am still getting grey fogs that can be noticed on chest, and if I use another duplicate and set layer mode to "dodge", then lines become too small.
https://speedstar.itos.pl/gimp/gimp-all_colors_alpha_layer_dodge.png
[Image: gimp-all_colors_alpha_layer_dodge.png]

Any ideas?
Thanks for any suggestions, and please, lets discuss it like intelligent adults, no useless comments, no childish behaviors.


RE: Pure black n white with smooth curves - Ofnuts - 04-25-2018

Well, you have tried all my suggestions Smile, so just trying to improve on method #2, starting with your result:
  • Duplicate the layer and apply a double threshold to it, keeping only the grays (in my final test, the first threshold is lower than in the image below, around 70). Note that the thick black lines are converted to two thin parallel white lines, corresponding to the antia-aliasing pixels .
[attachment=1653]
  • Filters>Generic>Erode: this removes these lines and keeps the rest, you can use Filters>Generic>Dilate to get back to the threshold results, except where the lines were 1px wide, since they have now disappeared.
  • Open the Channels list, right click any of the R,G or B channels and Channel to selection. You now have a selection on all the grays that aren't anti-aliasing pixels.
  • Selection used for a Threshold:
[attachment=1654]



RE: Pure black n white with smooth curves - Espermaschine - 04-26-2018

^

I dont get it at all.

OP wants his image converted to pure black and white, but without loosing the antialiasing, right ?

Your Threshold action produces a selection ?


RE: Pure black n white with smooth curves - Ofnuts - 04-26-2018

(04-26-2018, 04:16 AM)Espermaschine Wrote: ^

I dont get it at all.

OP wants his image converted to pure black and white, but without loosing the antialiasing, right ?

Your Threshold action produces a selection ?

On a black line, the threshold selects only the anti-aliasing pixels. The fully black part of the line is not selected, all you get for a black line is two thin parallel lines corresponding to the edges. The threshold extracts the grey patches plus the anti-aliasing. Then, the Erode step removes the thin lines, so you are left with just the grey patches...


RE: Pure black n white with smooth curves - rich2005 - 04-26-2018

Just a suggestion, but have you considered converting the image to a vector using Inkscape. Using 'brightness' loses the colours and does produce a somewhat stylised image but does have clean lines.

[Image: vQ5GwAS.png]

Edit:
If you have many similar to do, then Inkscape becomes a bit tedious.

Not as smooth but you could try the g'mic plugin http://www.gmic.eu

Black and White section.
The Stamp filter with settings as: https://i.imgur.com/TdP5zAN.jpg
Want a bit of shading but not grey, the dither filter: https://i.imgur.com/abo0Hm8.jpg


RE: Pure black n white with smooth curves - ociebieda - 04-27-2018

Thanks, I tested out all your suggestions, trying various values for parameters.
Finally, I ended up with something that I am not sure if I can get better results with such source image.
Converting to vector with Inkspace was an idea that took my attention most.
The problem was that image lost too much details after it.
So, I started to play with original image to check how some changes may affect results of this conversion.
I used Irfan View and my lastest modification experimental combo was gamma 2.0, contrast -64, and whats most important I guess, using a lof of sharpen effect to highlight details.
Using of each effect and values may depend on image and personal preferences of course, but what I mean is modify image before conversion, especially searching for something that may improve details like sharpen.
In Inkscape, I used "Trace Bitmap" from right click menu and choose default "Brightness cutoff" with 0,45, which was best setting for me in case of this image.
I ended up with in my opinion improved details (noticeable on helmet) when compared to all other methods I tried.
I hope this might be some suggestion to try by someone in the future.
If something else come to your mind, let me know.
Mentioned results below.

https://speedstar.itos.pl/gimp/irfanview-sharpen.png
[Image: irfanview-sharpen.png]

https://speedstar.itos.pl/gimp/inkscape-trace_bitmap_brightness_cutoff.png
[Image: inkscape-trace_bitmap_brightness_cutoff.png]