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

Only resize an image if it results in a smaller image size #32787

Closed
wants to merge 3 commits into from

Commits on Jun 9, 2022

  1. Only resize an image if it results in a smaller image size

    Current default behaviour (for the last 2 years at least, or more) has been that any background file that is 'not an SVG or a GIF' will be resized *and stored as a PNG*. When uploading a large compressed (e.g. webp or jpg) image this default results in huge (1 MB+) background images. This is counterproductive as the intent of this function is to reduce file size.
    
    With this change, only if the resulting image has a smaller
    file size than the original file, the new file is used.
    
    Signed-off-by: JelleV <3942301+jcjveraa@users.noreply.github.com>
    jcjveraa committed Jun 9, 2022
    Configuration menu
    Copy the full SHA
    48eb65e View commit details
    Browse the repository at this point in the history
  2. Fix docstring

    Docstring was copy-pasted and not updated.
    
    Signed-off-by: JelleV <3942301+jcjveraa@users.noreply.github.com>
    jcjveraa committed Jun 9, 2022
    Configuration menu
    Copy the full SHA
    c9f94dd View commit details
    Browse the repository at this point in the history
  3. Retain file type but ensure 'progressive' image

    Realized after having a think about my previous commits that the intent
    of the original function was also to ensure images are stored in a
    progressively loading format. With these further changes, I think the
    original intern is captured more closely.
    
    Signed-off-by: JelleV <3942301+jcjveraa@users.noreply.github.com>
    jcjveraa committed Jun 9, 2022
    Configuration menu
    Copy the full SHA
    8b7afdb View commit details
    Browse the repository at this point in the history