0

OK so here I have a problem I want solved, but I wouldn't know the beginning of how to correctly formulate it. So bear with me!

Sometimes when I postprocess b&w photographs in darktable, I change the tone curve in such a way that everything below (darker than) a certain level of gray gets "leveled out" to that level of grey. Losing the shadows, that is. (I do this by making a little horizontal "flat piece" in the bottom left corner of the tone curve square, where the left side touches the side of the square.) A prime example of this is the following photo, in which I erased all the shadows right under the bridge, creating that "flat" look that old photographs often have.

Only the problem is, sometimes when I do this, probably just because the tone curve square is not precise enough for me to get it just right, the deepest black pixels stay, as in this photo:

As I apparently am not able to solve this in darktable, I hoped there would be some imagemagick one-liner with which I could just "flatten out" these darkest pixels to the desired gray level. Say, something like:

  • convert in.jpg -flatten_up 10 out.jpg

..which would then take all r, g, and b values below 10 and change them to 10, effectively replacing the black pixels by darkgrey.

Kelley van Evert
  • 1,063
  • 2
  • 9
  • 17
  • Have you tried converting "-level 10" to make 10 your black point, thereby losing everything below 10, then converting "-level +10" to move your black point back up to "10"? – Mark Setchell Jan 22 '14 at 19:26
  • Fantastic simple solution :) Thx – Kelley van Evert Jan 22 '14 at 19:50
  • So the final command is: `convert original.jpg -level 10%,100% intermediate.jpg && convert intermediate.jpg -level -10%,100% final.jpg`, BTW. (Note the second argument for the white point.) – Kelley van Evert Jan 22 '14 at 19:52
  • If you are happy with it, I'll make it an answer and you can accept it - so I get a lovely big green tick and some points! Is that ok? – Mark Setchell Jan 22 '14 at 19:55
  • By the way, if you use 10% that means flatten to a pixel value of 25, which is 10% of 255. Whereas if you use 10, that means flatten to a pixel value of 10. – Mark Setchell Jan 22 '14 at 20:07
  • Yes to both :) Make an answer and I'll tick it && 10% just worked out best for me, I know that 10% = 25 of 255. (Or, 26 maybe :P) – Kelley van Evert Jan 22 '14 at 23:30

2 Answers2

2

Try converting "-level 10" to make 10 your black point, thereby losing everything below 10, then converting "-level +10" to move your black point back up to 10.

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
0

You can use a parametric masks on darktable in order to only affect the darker areas of your image. That way you can manipulate and highlight the darkest areas without affecting the rest, and if part of the shadows are being affected, just combine a draw mask to select the area that your parametric mask will affect. This masks can be applied almost to any module on darktable. parametric mask + draw mask example of usage