You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Include IANA-registered media type in metadata response #4492
Is this a possible bug in a feature of sharp, unrelated to installation?
Running npm install sharp completes without error.
Running node -e "require('sharp')" completes without error.
If you cannot confirm both of these, please open an installation issue instead.
Are you using the latest version of sharp?
I am using the latest version of sharp as reported by npm view sharp dist-tags.latest.
If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.
If you are using another package which depends on a version of sharp that is not the latest, please open an issue against that package instead.
What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?
Does this problem relate to file caching?
The default behaviour of libvips is to cache input files, which can lead to EBUSY or EPERM errors on Windows.
Use sharp.cache(false) to switch this feature off.
Adding sharp.cache(false) does not fix this problem.
Does this problem relate to images appearing to have been rotated by 90 degrees?
Images that contain EXIF Orientation metadata are not auto-oriented. By default, EXIF metadata is removed.
To auto-orient pixel values use the parameter-less rotate() operation.
Hello, the output is correct; AVIF images use a container format of heif and a codec of av1. This applies also to HEIC images, which use the heif container and the hevc codec.
The docs have recently been updated (but not yet published) - see #4483 (comment)
Hello, the output is correct; AVIF images use a container format of heif and a codec of av1. This applies also to HEIC images, which use the heif container and the hevc codec.
In theory, this is correct. But in most cases, this will bring extra pain for web developer. Considering Node.js is mostly used for web apps, having a short cut for AVIF does make sense.
AVIF has its own file extension .avif
AVIF has its own MIME type image/avif
It is the same idea that supports both .avif() and .heif() output methods. Because web developers use avif so much more than heif or heic.
I quite like the idea of providing an image's MIME type as part of the metadata as this would allow support for future things like image/avif-sequence (when animated AVIF is implemented upstream). Would this help with your scenario?
Activity
[-]Read .avif metadata but get heic format[/-][+]Read .avif metadata but get heif format[/+]lovell commentedon Jan 29, 2026
Hello, the output is correct; AVIF images use a container format of
heifand a codec ofav1. This applies also to HEIC images, which use theheifcontainer and thehevccodec.The docs have recently been updated (but not yet published) - see #4483 (comment)
guoyunhe commentedon Jan 30, 2026
In theory, this is correct. But in most cases, this will bring extra pain for web developer. Considering Node.js is mostly used for web apps, having a short cut for AVIF does make sense.
.avifimage/avifIt is the same idea that supports both
.avif()and.heif()output methods. Because web developers useavifso much more thanheiforheic.lovell commentedon Jan 30, 2026
I quite like the idea of providing an image's MIME type as part of the metadata as this would allow support for future things like
image/avif-sequence(when animated AVIF is implemented upstream). Would this help with your scenario?guoyunhe commentedon Jan 30, 2026
Would be great if MIME type can be provided, which is more universal when you need to exchange info with other libraries and systems.
[-]Read .avif metadata but get heif format[/-][+]Include IANA-registered media type in metadata response[/+]lovell commentedon Jan 30, 2026
Excellent, thank you, I've tagged this as a future possible enhancement.
Add Media Type to metadata response #4492
lovell commentedon Jun 10, 2026
sharp v0.35.0 now available with this feature, thank you for the suggestion.
adityapatadia commentedon Jun 13, 2026
Hi @lovell I think
mediaTypemetadata type is not included in the type definitions. Can you please check?TypeScript: Add mediaType to metadata response #4492
lovell commentedon Jun 14, 2026
Fixed via bf7d8cd, thanks for reporting.
chore(deps): update dependency sharp to ^0.35.5 (#9)