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

Implement streamtype=1 option for tables-only JPEG encoding #7491

Merged
merged 1 commit into from
Nov 11, 2023

Commits on Oct 25, 2023

  1. Implement streamtype=1 option for tables-only JPEG encoding

    We already support streamtype=2 to skip producing JPEG tables, but
    streamtype=1, which skips everything but the tables, was never implemented.
    The streamtype=1 stub code dates to Git pre-history, so it's not
    immediately clear why.  Implement the missing support.
    
    jpeg_write_tables() can't resume after a full output buffer (it fails with
    JERR_CANT_SUSPEND), so it might seem that Pillow needs to pre-compute the
    necessary buffer size.  However, in the normal case of producing an
    interchange stream, the tables are written via the same libjpeg codepath
    during the first jpeg_write_scanlines() call, and table writes aren't
    resumable there either.  Thus, any buffer large enough for the normal case
    will also be large enough for a tables-only file.
    
    The streamtype option isn't documented and this commit doesn't change that.
    It does add a test though.
    
    Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
    bgilbert and radarhere committed Oct 25, 2023
    Configuration menu
    Copy the full SHA
    4d7372b View commit details
    Browse the repository at this point in the history