Niels-IO / next-image-export-optimizer

Use Next.js advanced <Image/> component with the static export functionality. Optimizes all static images in an additional step after the Next.js static export.
MIT License
439 stars 52 forks source link

Add `unoptimized` configuration option #212

Closed beschler closed 6 months ago

beschler commented 6 months ago

Issue

The configuration options in the documentation do not list an option to not optimize an image.

Use Case

I am looking to only download remote images from an AWS S3 bucket into static assets for a static site at build time. However, the images on the remote server are already optimized, and I would like an option to not perform any additional optimizations / transformations on the images when they are downloaded.

Proposed Solution

Add a new configuration option (e.g. titled unoptimized) with a boolean value, with a default of false. If set to true, the specified remote image(s) would be downloaded and stored as local static images, but no optimizations would be applied in the process.

Precedent

The similar library next-image-export-optimizer allows for the prop unoptimized={true}: https://github.com/Niels-IO/next-image-export-optimizer/blob/master/README.md?plain=1#L185


Big thanks to everyone on this team for creating this package! It solves what seems to me to be a very obvious use case missing from Next.js.