next.jsmetadatasharpiptc

Is it possible to configure a Next.js application to automatically add IPTC data on all website images by customizing the Image Optimization step?


I have a Next.js 13 website running with proprietary images.

Some of them have IPTC Photo Metadata but Next.js Image optimization by default is removing them.

Is it possible to customize Next.js app to keep them or even better to add a predefined set of IPTC metadata on all images of the website by customizing the optimization step?

I tried to look in Next.js Image Component API documentation I see that sharp can read IPTC Metadata so I imagine it could be possible to customize the image optimization step to add IPTC metadata?


Solution

  • In current version of Next.js (13.1.1) it is not possible to keep Image IPTC metadata with image optimization.

    Sharp can be used to keep image metadata using withMetadata().
    You can vote for this feature request here.