简体   繁体   English

如何使用 Javascript 将 HEIF (.heic) 图像格式中的 EXIF 方向值设置为 1 并将结果作为 blob 返回?

[英]How to set EXIF Orientation value to 1 in HEIF (.heic) image formats using Javascript and return the result as a blob?

I have a blob created from an HEIF image which probably contains EXIF Orientation value.我有一个从 HEIF 图像创建的 blob,它可能包含 EXIF 方向值。 I'm using heif2any.js to convert it to JPEG image but I want to prevent double-rotation problem stated in this answer: https://stackoverflow.com/a/28596303/9249141 (the library suggested to be used does not support HEIF format).我正在使用 heif2any.js 将其转换为 JPEG 图像,但我想防止此答案中所述的双旋转问题: https ://stackoverflow.com/a/28596303/9249141(建议使用的库不支持HEIF 格式)。

So I simply need a JS function which takes a blob created from an HEIF image, remove its EXIF Orientation tag OR set EXIF Orientation value to 1, and then return the result as a new blob.所以我只需要一个 JS 函数,它接受从 HEIF 图像创建的 blob,删除其 EXIF 方向标记或将 EXIF 方向值设置为 1,然后将结果作为新 blob 返回。

You don't need to worry about it since heic2any discards metadata in the conversion.您无需担心它,因为 heic2any 会在转换中丢弃元数据。 That's one of the downsides of the utility, but an upside for you!这是该实用程序的缺点之一,但对您来说是一个好处!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM