简体   繁体   English

Angular中如何将Heic图像文件转换为Jpeg或Png格式以供ngx-image-cropper使用?

[英]How to convert a Heic image file to a Jpeg or Png in Angular for ngx-image-cropper to use?

Question - ngx-image-cropper doesn't accept Heic image files as it's '[imageChangedEvent]' input so how would I convert an Heic image file to a Jpeg or Png in Angular/typescript?问题- ngx-image-cropper 不接受 Heic 图像文件,因为它是“[imageChangedEvent]”输入,所以我如何将 Heic 图像文件转换为 Angular/typescript 中的 Jpeg 或 Png?

FYI - I'm loading images into ngx-image-cropper and it looks like it doesn't except Heic image files.仅供参考 - 我正在将图像加载到 ngx-image-cropper 中,看起来它除了 Heic 图像文件之外没有。 Ngx-image-cropper is emitting a loadImageFailed() emitter if the file type is 'image/heic'.如果文件类型为“image/heic”,则 Ngx-image-cropper 会发出 loadImageFailed() 发射器。

Currently I open image files with a fileChangeEvent() from an input element, I guess I want to convert to a jpeg or png so that I can pass it to a the ngx-imge-cropper imageChangedEvent or it's base64 input?目前我使用来自输入元素的 fileChangeEvent() 打开图像文件,我想我想转换为 jpeg 或 png 以便我可以将它传递给 ngx-imge-cropper imageChangedEvent 或者它是 base64 输入?

There is one NPM package named Heic2any you can use this for image conversion.有一个名为 Heic2any 的 NPM package你可以用它来进行图像转换。

This answer might help you with image conversion.此答案可能会帮助您进行图像转换。 Please take a look into this请看看这个

Heic2any: Heic2any:

Official doc官方文档

NPM Package NPM Package

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

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