从图像中提取exif方向数据 [英] extract exif orientation data from image

查看:588
本文介绍了从图像中提取exif方向数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能存在重复:


我需要使用Javascript从HTML JPEG图像中提取方向EXIF数据。 根据

href =http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html =nofollow noreferrer> exiftool's documentation 方向标志位于偏移量0x112处EXIF标记,占用2个字节。

我想我们只需要提取良好的偏移量的数据并转换该值,但我没有任何想法如何在浏览器中实现这一点。结果值应该是介于1和8之间的数字,用于描述方向。



如何从简单的IMG标签读取数据?
我只需要一个webkit的解决方案,但仅限浏览器。



谢谢!

解决方案

可能重复此问题



谢谢。这里是获取方向的最终代码示例:

  var b64 =data:image / jpeg; base64,/ 9j / 4AAQSkZJRgABA。 .....; 
var bin = atob(b64.split(',')[1]);
var exif = EXIF.readFromBinaryFile(new BinaryFile(bin));
alert(exif.Orientation);


Possible Duplicate:
Accessing JPEG EXIF rotation data in Javascript on the client side

I'd need to extract the orientation EXIF data from an HTML JPEG image with Javascript.

according to exiftool's documentation the orientation flag is found at offset 0x112 within the EXIF marker, and occupies 2 bytes.

I guess we just need to extract the data at good offset and 'convert' the value but i don't have any idea how to achieve this in the browser. The result value should be a number between 1 and 8 describing the orientation.

How to read that data from a simple IMG tag ? I need a webkit only solution, but browser only.

Thanks !

解决方案

Possible duplicate of this question.

thanks. here's the final code example to get orientation :

var b64 = "data:image/jpeg;base64,/9j/4AAQSkZJRgABA......";
var bin = atob(b64.split(',')[1]);
var exif = EXIF.readFromBinaryFile(new BinaryFile(bin));
alert(exif.Orientation);

这篇关于从图像中提取exif方向数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆