Results 1 to 5 of 5

Thread: PNG color tables in Batch mode - How to force a uniform color table for all files?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    IV Newbie TerraHertz's Avatar
    Join Date
    May 2019
    Location
    Sydney Australia
    Posts
    3
    Version
    IrfanView 4.44
    OS
    32-bit Win XP Pro SP3

    Default PNG color tables in Batch mode - How to force a uniform color table for all files?

    This is a problem that has been bugging me for a while, and now I face the same problem again.
    When converting old paper documents to electronic form with good quality, there's a series of stages:
    1. Scan at hi-res, gray-scale or color.
    2. Perform fix-ups of each page in photoshop (B&W saturation, deskew, align to uniform page borders, despeck, etc.)
    3. Scale down to final size (still in RGB24.)
    4. Apply optimum image compression to all pages. ie reduce bits per pixel.
    5. Encapsulate page images in whatever form suits. (I tend to use RAR-book with html doc structure, rather than PDF.)

    I use Irfanview for stages 1, 3 & 4.
    But there is one problem. Typically for B&W text I compress the final images in PNG 16 color ie 4 bits per pixel, since this preserves enough edge shading on characters to avoid jaggies. Sometimes printed pages may have another ink color, with both solid and flat screened areas. This means at least two of the color table entries need to be 'other than gray scale'. That's OK, easily sorted with single images.

    But, for multi-page documents (ie almost always) its very desirable for all page images to use identical color tables. Otherwise there can be variation in appearance from page to page. So where even one page has a 2nd ink color, all pages should use the color table adapted to that one page.

    But how to make Irfanview use a uniform color table when doing batch multi-file compression to PNG-16 or 256?

    It would also be good to be able to generate and save a color table (say from a specific page image) then manually ensure it contains pure white and black plus any other special colors needed, then instruct Irfanview to use that color table when doing batch compression of many images.

  2. #2
    IV Newbie TerraHertz's Avatar
    Join Date
    May 2019
    Location
    Sydney Australia
    Posts
    3
    Version
    IrfanView 4.44
    OS
    32-bit Win XP Pro SP3

    Default

    So, this is going to be ignored?
    Sigh. I was hoping I'd just missed some existing method for unifying color tables across multiple PNG/GIF indexed color images. But no? There's no way to do it in Irfanview?
    That's a shame, there is a real need for this.

    Ideally when scanning a multi-page document, one could pick a representative page image, process and compress it, then save the color table to a file. Preferably in a human readable and editable form, like {index #} {RGB} with RGB in the #RRGGBB hex form, same as html. One per line.

    Then when doing the batch processing of all pages to the final compressed form, tell Irfanview to load that color table file and use exactly that for encoding of all images.

    I guess since no one commented about future plans to add such a feature to Irfanview, there's no chance of that happening either?

  3. #3
    Power User j7n's Avatar
    Join Date
    Jun 2006
    Location
    Cyberspace
    Posts
    541
    Version
    IrfanView 4.51
    OS
    32-bit Win Server 2003 SP1
    CPU Cores
    1

    Default

    You can load/export a palette (Image>Palette) in Jasc Paint Shop Pro human-readable format in IrfanView, but that function is not available in batch mode. Maybe you can request Irfan over e-mail for this to be added under change color depth.

    Since you are already using Photoshop for part of the process, you could do the batch conversion in it with an action recorded to load a custom palette. A limitation appears to be that the colors are contained in the action itself, so you'd need to "record" a new one to use different colors. It can only load binary Microsoft/Adobe palette formats, but you can save any of them using a proxy image file.

  4. #4
    IV Newbie TerraHertz's Avatar
    Join Date
    May 2019
    Location
    Sydney Australia
    Posts
    3
    Version
    IrfanView 4.44
    OS
    32-bit Win XP Pro SP3

    Default

    >You can load/export a palette (Image>Palette) in Jasc Paint Shop Pro human-readable format in IrfanView,

    Ah! Thanks. Despite searching I somehow missed that menu item. That's one step closer to what I need.

    >but that function is not available in batch mode. Maybe you can request Irfan over e-mail for this to be added under change color depth.

    I'll try that.

    >Since you are already using Photoshop for part of the process, you could do the batch conversion in it with an action recorded to load a custom palette. A limitation appears to be that the colors are contained in the action itself, so you'd need to "record" a new one to use different colors. It can only load binary Microsoft/Adobe palette formats, but you can save any of them using a proxy image file.

    I prefer not to use Photoshop for the final image compress stage, because a) It's not very good. and b) it puts in too much EXIF crap. Irfanview produces a good clean file.

    It's a shame Irfanview seems to be a bit weak in handling palettes. Another problem: take a cleaned-up text page scan RGB image, in which all the paper is pure #ffffff white, all the ink bulk areas are pure #000000 black, and the only grays are in the character edges. Use Irfanview to reduce to 16 color palette (for 4 bits/px PNG), and the resulting palette does not contain either 000000 or ffffff. That's really poor. Part of the reason I need to be able to edit then force use of a standard palette.

  5. #5
    Power User j7n's Avatar
    Join Date
    Jun 2006
    Location
    Cyberspace
    Posts
    541
    Version
    IrfanView 4.51
    OS
    32-bit Win Server 2003 SP1
    CPU Cores
    1

    Default

    The basic color reduction method is indeed bad, it adds 240 for white. "Best color quality" is very slow, but selected 255,255,254 and 3,2,3, which are very close to white/black. The new "best" method is quite good on most images. In Photoshop none of perceptual/selective/adaptive add pure white either, unless forced.

    I tried exporting a 256 color image with 16 colors in use, most frequent colors black/white in the first slots, and unused slots set to hot pink (which isn't found on the image). The PNG compression from Photoshop was not optimal. After recompressing with IrfanView, the size was close to the same image encoded as 16-color. A second pass compression can be done quickly in batch mode, compared to the time it takes to scan and clean. You could save to uncompressed BMP (can also be 4-bit) with precisely reduced colors from Photoshop and the convert in IV. It seems this method is the best until IrfanView gets the color table function added.

    Edit: Maybe it is worth requesting a checkbox for inclusion of black/white.
    Last edited by j7n; 27.05.2019 at 02:48 PM.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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