Skip to content

Transform Images plugin should avoid upsizing images have smaller size than the resize options. #530

@ngdangtu-vn

Description

@ngdangtu-vn

Version

2.0.1

Platform

Linux/Deno

What steps will reproduce the bug?

  1. add an image worth 800 × 800
  2. add another image worth 1280 × 1280
  3. add resize like below:
    export default {
      transformImages: [
        {
          // origin
          format: 'webp',
        },
        {
          format: 'webp',
          resize: [300],
          suffix: '-xs',
        },
        {
          format: 'webp',
          resize: [900],
          suffix: '-xl',
        },
      ]
    }
  4. run build script

How often does it reproduce? Is there a required condition?

always

What is the expected behavior?

The 800 resolution image should not be upsize to 900.

What do you see instead?

The 800 resolution image got upsize to 900.

Additional information

I believe if we can ignore upsizing the image with smaller size can speed up the process. Moreover, there is no point to use a upsized images in web. And in case of sb really need it, we can add it as an optional feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions