List of usage examples for org.apache.commons.imaging.common IImageMetadata getItems
public List<? extends IImageMetadataItem> getItems();
From source file:lucee.runtime.img.Metadata.java
private static void fill(String format, InputStream is, Struct info) throws ImageReadException, IOException { // get all metadata stored in EXIF format (ie. from JPEG or TIFF). IImageMetadata metadata = Imaging.getMetadata(is, "test." + format); if (metadata == null) return;//from ww w .j a va 2s.c om // System.out.println(metadata); if (metadata instanceof JpegImageMetadata) { final JpegImageMetadata jpegMetadata = (JpegImageMetadata) metadata; try { set(jpegMetadata.getItems(), info, null); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } try { set(metadata.getItems(), info, null); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } // Photoshop if (metadata instanceof JpegImageMetadata) { JpegPhotoshopMetadata photoshop = ((JpegImageMetadata) metadata).getPhotoshop(); if (photoshop != null) { try { List<? extends IImageMetadataItem> list = photoshop.getItems(); if (list != null && !list.isEmpty()) { Struct ps = new StructImpl(); info.setEL("photoshop", ps); try { set(list, ps, null); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } } } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } } } // EXIF if (jpegMetadata != null) { Struct exif = new StructImpl(); info.setEL("exif", exif); try { set(jpegMetadata.getExif().getItems(), exif, null); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } } // GPS try { gps(jpegMetadata, info); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } } }