I read in a file from an HTML file input. For iOS I can take a picture from the camera. The problem is that if you take the picture with the camera the content will include EXIF data(at least if I read the file content with the FileReader API).
我从一个HTML文件输入的文件中读取。对于iOS,我可以用相机拍照。问题是,如果你用相机拍照,内容将包括EXIF数据(至少如果我用FileReader API读取文件内容)。
I can't use canvas cropping if the image includes EXIF data. Because the image get destroyed every time I call
.toDataURL()
. My guess is it doesn't recognize EXIF data and don't know how to crop a image with EXIF data.如果图像包含EXIF数据,我就不能使用画布裁剪。因为每次调用. todataurl()时,图像都会被销毁。我猜它不认识EXIF数据,也不知道如何用EXIF数据裁剪图像。
The file content is being base64 encoded by
FileReader.readAsDataURL()
. And I insert it into img.src.文件内容是由FileReader.readAsDataURL()编码的base64。我把它插入img。src。
The cropping is done by drawing a new image with
ctx.drawImage(...)
based in the old image and I finally got the new image data withc.toDataURL()
.裁剪是通过基于旧图像的ctx.drawImage(…)绘制新的图像来完成的,最后我用c.toDataURL()获得新的图像数据。
So my question how do I remove EXIF data using javascript?
我的问题是如何使用javascript删除EXIF数据?
1 个解决方案
#1
5
Note, you wrote:
请注意,您写道:
the image get destroyed
的形象被破坏
I think that problem is not in EXIF data. I think you have the iOS canvas limitation:
我认为问题不在EXIF数据中。我认为你有iOS的canvas限制:
The maximum size for a canvas element is 3 megapixels for devices with less than 256 MB RAM and 5 megapixels for devices with greater or equal than 256 MB RAM.
canvas元素的最大大小是小于256兆RAM的设备的300万像素,大于或等于256兆RAM的设备的500万像素。
This limits don't throw any errors, so then you will try to render or read 6MB image you will get a broken blob/dataURL string and so on. And you will think that File API is broken, canvas methods toDataURL/toBlob are broken, and you will be right. But bugs aren't in browser, this is a system limitation.
这个限制不会抛出任何错误,因此,您将尝试呈现或读取6MB的图像,您将得到一个破损的blob/dataURL字符串,等等。你会认为文件API被破坏了,画布方法toDataURL/toBlob被破坏了,你是对的。但是bug不在浏览器中,这是系统的限制。
There known libs that fix iOS limitations:
有一些已知的libs可以修复iOS的局限性:
- Javascript-Load-Image
- Javascript-Load-Image
- ios-imagefile-megapixel
- ios-imagefile-megapixel
#1
5
Note, you wrote:
请注意,您写道:
the image get destroyed
的形象被破坏
I think that problem is not in EXIF data. I think you have the iOS canvas limitation:
我认为问题不在EXIF数据中。我认为你有iOS的canvas限制:
The maximum size for a canvas element is 3 megapixels for devices with less than 256 MB RAM and 5 megapixels for devices with greater or equal than 256 MB RAM.
canvas元素的最大大小是小于256兆RAM的设备的300万像素,大于或等于256兆RAM的设备的500万像素。
This limits don't throw any errors, so then you will try to render or read 6MB image you will get a broken blob/dataURL string and so on. And you will think that File API is broken, canvas methods toDataURL/toBlob are broken, and you will be right. But bugs aren't in browser, this is a system limitation.
这个限制不会抛出任何错误,因此,您将尝试呈现或读取6MB的图像,您将得到一个破损的blob/dataURL字符串,等等。你会认为文件API被破坏了,画布方法toDataURL/toBlob被破坏了,你是对的。但是bug不在浏览器中,这是系统的限制。
There known libs that fix iOS limitations:
有一些已知的libs可以修复iOS的局限性:
- Javascript-Load-Image
- Javascript-Load-Image
- ios-imagefile-megapixel
- ios-imagefile-megapixel