对于图像元数据,什么标签允许最大字符限制?
例如,Exif 标准有一个“用户评论”标签,我认为该标签的长度限制为 256 个字符。
如果我想将一个故事添加到元数据中,那么对于几兆字节的文本来说,什么是我的最佳选择。
基本上,我试图将某些内容存储在图像中,并且在 iPhone 之间传输时不会丢失。我之前将这个图像直接写入图像中,将其转换为 NSData,然后附加巨大的字符串,然后将 NSData 更改为 UIImage。这有效,但当我通过电子邮件、短信或将其放入照片库时,我添加的所有信息都丢失了。
显然元数据保留在图像中,我使用用户评论让它工作,但有字符限制。
我该如何使用现有标签或制作自己的标签,这样我就可以对文本大小几乎没有限制?我不在乎文件有多大。
For example the Exif standard has a "User Comment" tag that has a limit of 256 characters I believe.
If I want to add lets say a story into metadata, what would be my best bet for several megabytes worth of text.
Basically I'm trying to store certain things inside of an image and have it not lost when transferred between iPhones. I wrote this image directly into the image before by converting it into NSData and then appending the huge string and then changing the NSData to UIImage. This worked but when I emailed, texted, or placed it inside the photolibrary, all information I added was lost.
Apparently metadata stays with the image and I have it working using user comment but there is a character limit.
How would I go about using an existing tag or making my own so I can have almost no limit on the text size? I don't care how big the file gets.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我假设您正在谈论 JPEG 图像,因为文件格式是这个问题的核心。
JPEG 图像具有固有的 64kB 段大小限制。 EXIF UserComment 没有长度限制,但 EXIF 仅限于单个 JPEG 段,因此限制为 64kB。
一些元数据编辑器(如 ExifTool)支持多段元数据类型。 XMP 和 JPEG 注释都可以跨越多个段。我建议简单地使用 JPEG Comment,因为 XMP 的多段支持可能不是很常见。如果您选择 XMP,类似 XMP-dc:Description 标签的内容可能比较合适。
I will assume you are talking about JPEG images because the file format is central to this question.
JPEG images have an inherent 64kB segment-size limit. The EXIF UserComment has no length limit, but EXIF is limited to a single JPEG segment, so it is restricted to 64kB.
Some metadata editors (like ExifTool) support multi-segment metadata types. Both XMP and JPEG comments may span multiple segments. I would suggest simply using the JPEG Comment because multi-segment support of XMP is probably not very common. If you choose XMP, something like the XMP-dc:Description tag may be suitable.
您是否研究过IPTC 扩展数据集?他们似乎允许你做你想做的事。
或者,如果图像直接在系统之间传输,您可以简单地将其附加到图像数据的末尾 - 例如,给定 JPG 谎言,我可以执行以下操作:
写入一些文本,并且它不会干扰读取 JPG 的应用程序。
当然,如果您需要传输的信息能够持续经过图像的多次编辑,那么 EXIF(或 IPTC)是存储数据的唯一方法。
Have you looked into the IPTC extended data sets? They seem to allow what you want to do.
Or if the image is going directly between systems, you could simply append it to the end of the image data - for example, given a JPG lie I can do something like:
write in some text, and it does not interfere with applications reading JPG.
Of course, if you need the transmitted information to last through several editings of the image, then EXIF (or IPTC) is the only way to store data.