From 8668e15d3eae497e193ab4d72a7dad8ab06a9691 Mon Sep 17 00:00:00 2001 From: phyto Date: Mon, 7 Dec 2020 12:52:17 +0100 Subject: [PATCH] desaturate added to crapulator --- Fonderie/crapulator.c | 29 ++++++++++++++++++++++++++--- Fonderie/essai.sh | 8 ++++---- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/Fonderie/crapulator.c b/Fonderie/crapulator.c index 83abc5d8..ac3b3ed6 100644 --- a/Fonderie/crapulator.c +++ b/Fonderie/crapulator.c @@ -76,9 +76,27 @@ fimg_destroy(&img); return retval; } /* -------------------------------------------------------------- */ +static int desaturate(FloatImg *pimg) +{ +FloatImg img; +int retval; +fimg_clone(pimg, &img, 0); +retval = fimg_desaturate(pimg, &img, 0); +if (retval) { + fprintf(stderr, "%s : err desaturate %d\n", + __func__, retval); + exit(1); + } +fimg_copy_data(&img, pimg); +fimg_destroy(&img); + +return 0; +} +/* -------------------------------------------------------------- */ /* - * This is the main filter engine - * used both for input and output + * This is the main filter engine used both for input and + * output processing. It can be called by the filterstack + * processor. */ #define DEBUG_THIS_CRAP 0 @@ -128,7 +146,7 @@ switch (idFx) { fimg_get_maxvalue(image)*0.8); break; case 6: - fimg_killcolors_a(image, 0.0); + retval = fimg_killcolors_a(image, 0.0); break; case 7: retval = fimg_colors_mixer_a(image, 2.0); @@ -151,6 +169,11 @@ switch (idFx) { case 13: retval = insitu_filtre3x3(image); break; + case 14: + retval = desaturate(image); + break; + + /* here are the glitches */ case 24: /* experiment ! */ retval = des_bords_sombres_a(image, 160); break; diff --git a/Fonderie/essai.sh b/Fonderie/essai.sh index 6b545120..91df6e44 100755 --- a/Fonderie/essai.sh +++ b/Fonderie/essai.sh @@ -1,6 +1,6 @@ #!/bin/bash -FILTRES="5:6:13 2:2 5:9:8 4:25 8:13:13:7 10:1 25:25:25:25" +FILTRES="5:6:13 2:2 5:9:8 4:25 8:13:13:7 10:1 25:25:25:25 13:14:13" rm /tmp/fstack*.png @@ -11,12 +11,12 @@ do echo ; echo $I ./t -F $F txt=$(printf "[%-10s]" $F) - convert foo.png -pointsize 28 -kerning 0 \ + convert foo.png -pointsize 24 -kerning 0 \ -fill Gray80 -undercolor Gray20 \ -font Courier-Bold \ - -annotate +0+25 "$txt" \ + -annotate +0+23 "$txt" \ $I done -convert -delay 150 /tmp/fstack*.png foo.gif +convert -delay 100 /tmp/fstack*.png foo.gif