python读取raw图片文件_【IT专家】使用Python读取CR2(原始佳能图像)头。

本文由我司收集整编,推荐下载,如有疑问,请与我司联系

使用

Python

读取

CR2(

原始佳能图像

)

头。

2010/09/12 6673

I’m

trying to extract the date/time when a picture was taken from

the CR2 (Canon format for raw pictures).

我试着从

CR2(

原始图片的

Canon

格式

)

中提取照片的日期

/

时间。

I

know

the CR2 specification,

and

I know

I can

use

Python struct

module

to

extract

pieces from a binary buffer.

我知道

CR2

规范,我知道我可以使用

Python

struct

模块从二进制缓冲区中提取片

段。

Briefly, the specification says that in Tag 0x0132 / 306 I can find an string of length 20

- the date and time.

简单地说,该规范说明在标签

0x0132 /

306

中,我可以找到一个长度为

20

的字符

——

日期和时间。

I tried to get that tag by using:

我试着用

:

struct.unpack_from(20*’s’,

buffer, 0x0132) but I get

但我得到

(‘

\

x00’,

\

x00’,

“‘“,

\x88, ...[and more crap]) Any ideas?

什么好主意吗

?

Edit

编辑

Many thanks for the thorough effort! The answers are phenomenal and I learned a

lot

about handling binary data.

非常感谢您的全面努力

!

答案是惊人的,我学到了很多关于处理二进制数据的知

识。

7

Have you taken into account the header which should (according to the spec)

precede

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值