to detect IPTC content in jpeg image

1.2k views Asked by At

I need to know how to check whether given jpeg image has iptc content in it or not ? This should be done with java.As i am new to this techonology. Could someone help regarding this.

2

There are 2 answers

0
jzafrilla On

You can use this library,

http://reader.imagero.com/

supported metadata:

IPTC (JPEG, TIFF, EPS, PSD)
EXIF (JPEG, TIFF, PSD)
XMP (JPEG, TIFF, EPS, PSD)
Wang Annotations (read only)
ImageResourceBlock
ImageFileDirectrory
JPEG Markers

Get IPTC metadata from one image and insert it in other:

String source = "C:\\images\\source.jpg";
String destination = "C:\\images\\destination.jpg";
IOParameterBlock iopb = new IOParameterBlock(source);
iopb.setDestination(destination);
IPTCEntryCollection collection = IPTC.getIPTC(iopb);
IPTC.insertIPTC(collection, iopb);
  • EDIT (Tutorial):

http://reader.imagero.com/tutorial.html

0
Ben Asmussen On

It simple by using the Metadata Extractor, an open source project for reading meta data - hosted on google code.

Supported directories

  • Exif
  • IPTC
  • XMP
  • JFIF / JFXX
  • ICC Profiles
  • Photoshop

Example

Reading HEADLINE TAG from IPTC Directory. There is an GettingStarted chapter.

  File file = new File("input.jpg");

  // read meta data from image
  Metadata metadata = ImageMetadataReader.readMetadata(file);

  // get all existing directories
  metadata.getDirectories();

  // check whether the iptc directory exists
  if (metadata.containsDirectory(IptcDirectory.class))
  {
      // read headline from iptc directory
      IptcDirectory directory = metadata.getDirectory(IptcDirectory.class);
      directory.getString(IptcDirectory.TAG_HEADLINE);
  }

Camera support

The library also read camera-specific data

  • Agfa
  • Canon
  • Casio
  • Epson
  • Fujifilm
  • Kodak
  • Kyocera
  • Leica
  • Minolta
  • Nikon
  • Olympus
  • Panasonic
  • Pentax
  • Sanyo
  • Sigma/Foveon
  • Sony