在网络上读取 PNG 元数据
我最近编写了一个Python模块,它使用PIL将元标签和值写入PNG图像,目的是让网页读取标签并对图像进行相应的排序(我对相机类型等默认内容不感兴趣,我例如,如果我刚刚参加过集会,请附加“CarModel”之类的标签。
有没有人推荐一种读取我目前正在使用 PHP 的 PNG 元数据的方法? (http://stackoverflow.com/questions/2190236/how-can-i-read-png-metadata-from-php在底部)这很棒,因为它只显示我添加的标签,但很烦人,因为我无法用许多图片的数据构建一个整齐数组,javascript可以做到这一点吗?
抱歉,如果我在解释时很垃圾,但我会重新解释。如果需要的话。
I've recently written a Python module that writes meta tags and values to PNG images using PIL, with the intent to have a webpage read the tags and sort the images accordingly (I'm not interested in the default stuff like Camera Type, I attach tags like "CarModel" if I've just been to a rally for example.
Does anyone recommend a way of reading the PNG meta? I'm using PHP at the moment (http://stackoverflow.com/questions/2190236/how-can-i-read-png-metadata-from-php at the bottom) which is great for the reason that it only pics up the tags I've added, but annoying as I can't figure away of building a neat array with the data for many pictures. Can javascript do this?
Sorry If I've been rubbish at explaining, but I'll re-explain if needs be.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
你应该看看下面的 php 函数 - exif_read_data
PS : 据我所知,javascript 无法做到这一点
you should have a look at the following php function - exif_read_data
PS: javascript can't do that as far as I know
以下是一个声称能够读取图像元数据的 Javascript 库的链接:
http://blog.nihilogic.dk/2008/08/imageinfo-reading-image-metadata-with.html
Here is a link to a Javascript library that claims to be able to read image metadata:
http://blog.nihilogic.dk/2008/08/imageinfo-reading-image-metadata-with.html
nihilogic Javascript 库对于客户端 EXIF 读取和解析确实非常有用;但这仅适用于 JPEG 图像,因为元数据仅支持 JPEG 和 TIFF 格式(并且 TIFF 格式仅受 Safari 浏览器本机支持)。
PNG 可以包含元数据,但不能包含 JPEG 或 TIFF 格式允许的 IPTC 或 EXIF 字段形式。
The nihilogic Javascript libraries are indeed very useful for client-side EXIF reading and parsing; but that only applies to JPEG images, as the metadata is supported only in the JPEG and TIFF format (and the TIFF format only supported natively by Safari browser).
PNG can include metadata but not in the form of IPTC or EXIF fields as JPEG or TIFF formats allow.
我有类似的任务。我必须将物理尺寸和附加元数据写入 PNG 文件。我找到了一些解决方案并将其合并到一个小型库中。
png-metadata
它可以读取和写入 PNG 元数据。它可以在客户端和服务器端使用。
也许它会对某人有所帮助。
以下是如何在浏览器中读取 PNG 元数据:
i had a similar task. I had to write physical dimensions and additional metadata to PNG files. I have found some solutions and combined it into one small library.
png-metadata
it could read and write PNG metadata. it could be used on client and server side.
May be it will help somebody.
Here how you can read PNG metadata in the Browser: