diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2019-01-07 16:22:51 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2019-01-07 16:22:51 +0000 |
commit | b69ed32eefbedb589d1b521d884bd511e2db3fdf (patch) | |
tree | 299fb5151c7e15be0302936beb8082c870e81680 /editor/ppmbrighten.c | |
parent | ee250e7490cbb3550fed22fdb98b7152cce20b72 (diff) | |
download | netpbm-mirror-b69ed32eefbedb589d1b521d884bd511e2db3fdf.tar.gz netpbm-mirror-b69ed32eefbedb589d1b521d884bd511e2db3fdf.tar.xz netpbm-mirror-b69ed32eefbedb589d1b521d884bd511e2db3fdf.zip |
Release 10.85.01
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@3495 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor/ppmbrighten.c')
-rw-r--r-- | editor/ppmbrighten.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/editor/ppmbrighten.c b/editor/ppmbrighten.c index 6ee6897b..96bca478 100644 --- a/editor/ppmbrighten.c +++ b/editor/ppmbrighten.c @@ -292,12 +292,17 @@ main(int argc, const char ** argv) { pm_tell2(ifP, &rasterPos, sizeof(rasterPos)); getMinMax(ifP, cols, rows, maxval, format, &minValue, &maxValue); pm_seek2(ifP, &rasterPos, sizeof(rasterPos)); - pm_message("Minimum value %u%% of full intensity " - "being remapped to zero.", - (minValue*100+MULTI/2)/MULTI); - pm_message("Maximum value %u%% of full intensity " - "being remapped to full.", - (maxValue*100+MULTI/2)/MULTI); + if (maxValue > minValue) { + pm_message("Minimum value %u%% of full intensity " + "being remapped to zero.", + (minValue*100+MULTI/2)/MULTI); + pm_message("Maximum value %u%% of full intensity " + "being remapped to full.", + (maxValue*100+MULTI/2)/MULTI); + } else + pm_message("Sole intensity value %u%% of full intensity " + "not being remapped", + (minValue*100+MULTI/2)/MULTI); } pixelrow = ppm_allocrow(cols); @@ -313,9 +318,11 @@ main(int argc, const char ** argv) { RGBtoHSV(pixelrow[col], maxval, &H, &S, &V); if (cmdline.normalize) { - V -= minValue; - V = (V * MULTI) / - (MULTI - (minValue+MULTI-maxValue)); + if (maxValue > minValue) { + V -= minValue; + V = (V * MULTI) / + (MULTI - (minValue+MULTI-maxValue)); + } } S = MIN(MULTI, (unsigned int) (S * cmdline.saturation + 0.5)); |