Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes pertaining background color and grayscale conversions #270

Open
wants to merge 2 commits into
base: libpng16
Choose a base branch
from

Commits on Jan 10, 2019

  1. Fix processing of background color when converting to grayscale

    When processing transparent pixels (with png_set_strip_alpha) while
    converting to grayscale (with png_set_rgb_to_gray), libpng failed to
    convert the background color specified to the user to grayscale as
    well. This caused the documented pattern of handling bKGD chunks to
    fail for this corner case.
    
    Note that in case of conversions in the opposite direction (grayscale
    to RGB), the background color was already properly converted to RGB.
    
    This patch fixes this inconsistency, and adds a test program to the
    test suite to verify the fix.
    CyberShadow committed Jan 10, 2019
    Configuration menu
    Copy the full SHA
    b5f6f3c View commit details
    Browse the repository at this point in the history
  2. Fix expanding low-bit grayscale background color

    When expanding low-bit (4-bit and lower) images to 8 or 16 bits, the
    background color (as set by png_set_background) only had its
    red/green/blue fields populated to the correctly expanded values, but
    the gray values were erroneously left at their unexpanded values. This
    caused transparency processing (as enabled by png_set_strip_alpha) to
    use the unexpanded background color when substituting transparent
    pixels.
    
    Rectify this by updating the .gray fields of the background color, and
    add a test.
    CyberShadow committed Jan 10, 2019
    Configuration menu
    Copy the full SHA
    55765b7 View commit details
    Browse the repository at this point in the history