用于读取和写入IPTC元数据到JPEG和TIFF的Java库

有没有人知道一些用于读取和写入 JPEG和TIFF的IPTC元数据的开源Java库? 现在我正在使用Apache Sanselan。 不幸的是,它只能读取IPTC而不能写入( http://commons.apache.org/sanselan/formatsupport.html )。
非常感谢您的帮助。
丹尼斯。

看看IIM4J 。 使用IIMWriter将IPTC IIM标记写入(jpeg)图像。

Apache Commons Imaging(以前称为sanselan)增加了对svn repo代码中的IPTC元数据的支持,以供下次发布。 我已经validation了从svn repo中检出的最新主干代码中的情况。 代码似乎很稳定,所以我希望发布的版本不会太远。 对于我的项目,这已经足够了。

这似乎是一个相当古老的问题,但以下是一些有用的信息:

读取EXIF,IPTC等等元数据可以使用Apache Commons Imaging(旧版Sanselan)或元数据提取器(由绘制noaks)完成。

可以使用以下类使用Apache Commons Imaging完成元数据的写入:

EXIF – ExifRewriter( http://commons.apache.org/proper/commons-imaging/apidocs/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriter.html

IPTC – JpegIptcRewriter( http://commons.apache.org/proper/commons-imaging/apidocs/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.html

XMP – JpegXmpRewriter( http://commons.apache.org/proper/commons-imaging/apidocs/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriter.html

我过去看过自己,但没找到。 我建议查看一个开源项目,如http://sofzh.miximages.com/java/ppre codepublic void example() throws Exception { File jpegFile = new File(yourJpgFile.jpg”); Metadata metadata = ImageMetadataReader.readMetadata(jpegFile); Iterator directory = metadata.getDirectoryIterator(); while (directory.hasNext()) { Object tag = directory.next(); if (tag instanceof ExifDirectory) { Iterator tags = ((ExifDirectory) tag).getTagIterator(); while (tags.hasNext()) { System.out.println(“EXIF: “+tags.next().toString()); } } else if (tag instanceof IptcDirectory) { Iterator tags = ((IptcDirectory) tag).getTagIterator(); while (tags.hasNext()) { System.out.println(“IPTC: “+tags.next().toString()); } } else if (tag instanceof JpegDirectory) { Iterator tags = ((JpegDirectory) tag).getTagIterator(); while (tags.hasNext()) { System.out.println(“JPEG: “+tags.next().toString()); } } else { System.err.println(tag.getClass()); } } }

Interesting Posts