next-optimized-images icon indicating copy to clipboard operation
next-optimized-images copied to clipboard

[Canary] Images are enlarged when sizes includes a larger size

Open Nick-Mazuk opened this issue 3 years ago • 0 comments

First of all, thanks for such an awesome plugin!

Second, when there's a size listed that's larger than the original image size, the plugin seems to create a larger image. This is not ideal because enlargening an image doesn't provide more detail and just increases the file size.

For instance, if you use the profile picture from the Next JS tutorial (which is 400x400) and use these size settings, it will create a version that's 2200x2200! The original file was 62 kB, and the file served is 64 kB (if supporting retina displays, it's 156 kB).

<Img src={require('profile.jpg')} sizes={[200, 700, 1500, 2200]} />

The same issue occurs when using an image.config.js file, which is perhaps more important since you don't know the original images file size when creating the settings.

Ideally, only smaller versions are created.

Nick-Mazuk avatar Aug 29 '20 00:08 Nick-Mazuk