Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: Decrease Color Depth enhancement

  1. #1
    IV Newbie
    Join Date
    Mar 2008
    Posts
    3

    Default Decrease Color Depth enhancement

    Yet, when one chooses to reduce color depth, e.g. of a scanned image, the program tends to make almost white fields less white.
    It would be better, when the new intensity ladder (e.g. 16 colors - 4 BPP) always includes pure black and pure white when luminances in the displayed image exist that are (already) nearly white resp. black.

    I think most users that intend to decrease color depth not only have the intention to save space, but also to remove noise or nearly white background on scanned documents, resp. get true black with text on documents.
    Both have a great impact on printing quality.

  2. #2
    Moderator Enterprise User Bhikkhu Pesala's Avatar
    Join Date
    May 2007
    Location
    East London
    Posts
    5,732
    Version
    IrfanView 4.51
    OS
    64-bit Win 10
    CPU Cores
    1

    Default

    I don't think the program should second guess what users want. Even though in most cases what you say may be the case.

    If that is what you want then you can increase the contrast.

    Reducing colours should attempt to retain as much colour information as possible. If I scan an old newspaper, perhaps I wish to retain the grey discolouring of the paper, and don't wish it to look pristine white.

    I attach a sample to show you why I think this is a bad idea. I increased the contrast on the original full-colour jpg to compensate for the darkening that happens when you reduce the colours to only 16. A JPG image could be made even smaller, by increasing compression, but that is not the point that I am trying to make.

    If the background had been reduced to white, the image would not look anything like the original stained newspaper colour.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Caslonsample.jpg 
Views:	241 
Size:	26.3 KB 
ID:	481  
    Last edited by Bhikkhu Pesala; 01.03.2008 at 05:31 PM.

  3. #3
    IV Newbie
    Join Date
    Mar 2008
    Posts
    3

    Default

    You're right. Increasing the contrast works well. In earlier versions of irfanview, any change of contrast, gamma etc. returned the image in a 24BPP mode. So, in future I can increase contrast after BPP reduction instead of before (or do a final contrast step - but this is not possible in batch mode).

    Nevertheless, I'd not agree with your example of the old newspaper. Simply because the noise of an old document background may cause patterns of white areas and almost white areas - which is more unnaturally. Refer to the image zupfkuchen.jpg as an example of this. I'd suggest that most users - sorry, me - want that plain white remains plain white when reducing the color depth.
    Truly, irfanview produces RGB 251x3, resp. RGB 4x3 as the extreme values when reducing to 4BPP, hence resulting in spurious black dots in "white" areas and raster patterned "black" areas in printouts (making text appearing a bit unsharp).
    See the image, where the extracted histogram shows that plain white and true black are not present. The top diagram represents a 24bpp grey sweep, where the bottom diagram represents a 4BPP state.

    BTW: your newspaper effect could well be arranged by reducing the contrast after a 4BPP operation. In effect no information is lost, when Irfanview would set the white RGB to 255x3 instead of 251x3 upon BPP reduction. The only affect on information lies in the actual thresholds where selection for pallette index 0 or 1 (etc.) is performed. These thresholds may well be left unchanged when the 4BPP output produces slightly different results.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	sweepcomparison.png 
Views:	247 
Size:	40.2 KB 
ID:	482   Click image for larger version. 

Name:	zupfkuchen.jpg 
Views:	209 
Size:	35.7 KB 
ID:	483  

  4. #4
    Moderator Sam_Zen's Avatar
    Join Date
    May 2007
    Location
    NL
    Posts
    1,896
    Version
    IrfanView 4.27
    OS
    Win XP Home SP1
    CPU Cores
    1

    Default

    Yep, I experienced this nuisance quite often, after scanning a paper, and converting it to a 4BPP PNG file.
    Background no longer white, but greyish. I'm able to correct this, if I want, so it's not a heavy problem.

    I want to add, that decreasing colors is not a guarantee that noise will be gone.
    But this can be solved with the Clone tool of IVPaint.

    Another option could be to load a proper 16-color palette file.
    0.6180339887
    Rest In Peace, Sam!

  5. #5

    Default

    I came here for this exact reason. I was hoping for a checkbox option that forces the auto-palette generation to make at least one colour pure white.

    My problem is that I do a lot of logo work, and love IrfanView for its PNGOUT support. It's often advantageous (for file size) though to reduce the colours to 16. It's often imperceptible, except that the otherwise white background changes colours.

  6. #6
    IV Newbie
    Join Date
    Mar 2007
    Location
    USA,NJ
    Posts
    4
    Version
    IrfanView 4.38
    OS
    64-bit Win 8
    CPU Cores
    4

    Default

    I also have very frequent issues converting JPG to GIF . Mostly when image really only has only a few colors. Perhaps a few options on the decrease color depth selection like :
    (_) prefer pure white
    (_) prefer pure black

  7. #7
    Moderator Sam_Zen's Avatar
    Join Date
    May 2007
    Location
    NL
    Posts
    1,896
    Version
    IrfanView 4.27
    OS
    Win XP Home SP1
    CPU Cores
    1

    Default

    Nice idea. Support ++

    An elegant extra would be to have this color as first or last color in the palette.
    Last edited by Sam_Zen; 04.04.2008 at 01:27 AM.
    0.6180339887
    Rest In Peace, Sam!

  8. #8
    IV Newbie G Johnson's Avatar
    Join Date
    May 2008
    Location
    Missouri
    Posts
    2
    Version
    IrfanView 4.10
    OS
    Win XP Pro SP2
    CPU Cores
    2

    Default

    Yes, I came searching the forum with exactly this wish: an option on decrease color depth so the whitest color becomes pure white. I've played with batch conversion (decrease color depth + increase contrast + increase brightness), but this did not always achieve the goal or had undesired side effects.

  9. #9
    Moderator Sam_Zen's Avatar
    Join Date
    May 2007
    Location
    NL
    Posts
    1,896
    Version
    IrfanView 4.27
    OS
    Win XP Home SP1
    CPU Cores
    1

    Default

    As long as there are no direct tools for this, I think the simplest workaround is with the palette.
    As soon as you have 256 colors or lower, there's a palette.
    So the nearly white color is one of the palette colors.
    Most of the time it's easy to recognize which one it is. And often it's the first or the last one.
    So, via Image/Palette goto Edit Palette, double-click on the color and replace it by white.

    Batch-processes become relevant with groups of images having the same kind of properties.
    If these files, after color-decreasing, contain almost the same palette, it could be worth to save the edited palette.
    This can be used in the command-line option "/import_pal=palfile".

    Unfortunately, this option is not represented in the Batch-conversion ('B') dialog of IV.
    0.6180339887
    Rest In Peace, Sam!

  10. #10
    Plugin Author MItaly's Avatar
    Join Date
    Jul 2007
    Location
    Milan, Italy
    Posts
    515
    Version
    IrfanView 4.27
    CPU Cores
    4

    Default

    A good way to resolve the problem would be to add a B/W threshold value option in 2bpp color reduction; I asked to Irfan if he could implement it, but he said that it's difficult to change the algorithm to support such threshold.
    BTW, another method that works quite well is to use IrfanPaint's floodfill tool with a medium-high tolerance value to make the background white before reducing the color depth.
    IrfanPaint developer
    The latest stable IrfanPaint version is the 0.4.13.70.
    IrfanPaint is now open-source (released under BSD license).

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •