Package com.drew.metadata.exif

Examples of com.drew.metadata.exif.ExifIFD0Directory


     */
    public static String getMake(Metadata metadata) {

        String makeString = null;

        ExifIFD0Directory exifDir = metadata.getDirectory(ExifIFD0Directory.class);
        if (exifDir != null) {
            makeString = exifDir.getDescription(ExifIFD0Directory.TAG_MAKE);
            if (makeString != null && !makeString.equals("none")) {
                return makeString;
            }
        }

View Full Code Here


        try {
            //Attempt to retrieve the metadata from the image.
            Metadata metadata = ImageMetadataReader.readMetadata(localFile);
            if (metadata != null) {
                ExifIFD0Directory exifDir = metadata.getDirectory(ExifIFD0Directory.class);
                if (exifDir != null) {
                    Integer orientationInteger = exifDir.getInteger(ExifIFD0Directory.TAG_ORIENTATION);
                    if (orientationInteger != null) {
                        imageTransform = convertOrientationToTransform(orientationInteger);
                    }
                }
            }
View Full Code Here

     */
    public static Date getDateDefault(Metadata metadata) {

        Date date = null;

        ExifIFD0Directory exifDir = metadata.getDirectory(ExifIFD0Directory.class);
        if (exifDir != null) {
            date = exifDir.getDate(ExifIFD0Directory.TAG_DATETIME);
            if (date != null) {
                return date;
            }
        }

View Full Code Here

     */
    public static String getModel(Metadata metadata) {

        String modelString = null;

        ExifIFD0Directory exifDir = metadata.getDirectory(ExifIFD0Directory.class);
        if (exifDir != null) {
            modelString = exifDir.getDescription(ExifIFD0Directory.TAG_MODEL);
            if (modelString != null && !modelString.equals("none")) {
                return modelString;
            }
        }

View Full Code Here

                metadata.get(TikaCoreProperties.CREATED));
    }

    @Test
    public void testExifHandlerParseDateFallback() throws MetadataException {
        ExifIFD0Directory exif = mock(ExifIFD0Directory.class);
        when(exif.containsTag(ExifIFD0Directory.TAG_DATETIME)).thenReturn(true);
        when(exif.getDate(ExifIFD0Directory.TAG_DATETIME)).thenReturn(
                new GregorianCalendar(1999, 0, 1, 0, 0, 0).getTime()); // jvm default timezone as in Metadata Extractor
        Metadata metadata = new Metadata();
       
        new ImageMetadataExtractor.ExifHandler().handle(exif, metadata);
        assertEquals("Should try EXIF Date/Time if Original is not set", "1999-01-01T00:00:00",
View Full Code Here

                metadata.get(TikaCoreProperties.CREATED));
    }
   
    @Test
    public void testExifHandlerParseDateError() throws MetadataException {
        ExifIFD0Directory exif = mock(ExifIFD0Directory.class);
        when(exif.containsTag(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(true);
        when(exif.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(null);
        Metadata metadata = new Metadata();
       
        new ImageMetadataExtractor.ExifHandler().handle(exif, metadata);
        assertEquals("Parsing should proceed without date", null,
                metadata.get(TikaCoreProperties.CREATED));
View Full Code Here

                System.out.println("Processed " + (file.length()/(1024d*1024)) + "MB file in " + (took / 1000000d) + "ms");

            if (wikiFormat) {
                String fileName = file.getName();
                String urlName = fileName.replace(" ", "%20"); // How to do this using framework?
                ExifIFD0Directory exifIFD0Directory = metadata.getOrCreateDirectory(ExifIFD0Directory.class);
                String make = escapeForWiki(exifIFD0Directory.getString(ExifIFD0Directory.TAG_MAKE));
                String model = escapeForWiki(exifIFD0Directory.getString(ExifIFD0Directory.TAG_MODEL));
                System.out.println();
                System.out.println("-----");
                System.out.println();
                System.out.printf("= %s - %s =%n", make, model);
                System.out.println();
View Full Code Here

                System.out.printf("Processed %.3f MB file in %.2f ms%n%n", file.length() / (1024d * 1024), took / 1000000d);

            if (wikiFormat) {
                String fileName = file.getName();
                String urlName = StringUtil.urlEncode(fileName);
                ExifIFD0Directory exifIFD0Directory = metadata.getDirectory(ExifIFD0Directory.class);
                String make = exifIFD0Directory == null ? "" : StringUtil.escapeForWiki(exifIFD0Directory.getString(ExifIFD0Directory.TAG_MAKE));
                String model = exifIFD0Directory == null ? "" : StringUtil.escapeForWiki(exifIFD0Directory.getString(ExifIFD0Directory.TAG_MODEL));
                System.out.println();
                System.out.println("-----");
                System.out.println();
                System.out.printf("= %s - %s =%n", make, model);
                System.out.println();
View Full Code Here

            Row(@NotNull File file, @NotNull Metadata metadata)
            {
                this.file = file;
                this.metadata = metadata;

                ExifIFD0Directory ifd0Dir = metadata.getDirectory(ExifIFD0Directory.class);
                ExifSubIFDDirectory subIfdDir = metadata.getDirectory(ExifSubIFDDirectory.class);
                ExifThumbnailDirectory thumbDir = metadata.getDirectory(ExifThumbnailDirectory.class);
                if (ifd0Dir != null) {
                    manufacturer = ifd0Dir.getDescription(ExifIFD0Directory.TAG_MAKE);
                    model = ifd0Dir.getDescription(ExifIFD0Directory.TAG_MODEL);
                }
                boolean hasMakernoteData = false;
                if (subIfdDir != null) {
                    exifVersion = subIfdDir.getDescription(ExifSubIFDDirectory.TAG_EXIF_VERSION);
                    hasMakernoteData = subIfdDir.containsTag(ExifSubIFDDirectory.TAG_MAKERNOTE);
View Full Code Here

    private boolean processUsingAdvancedMetadata( Node imageNode,
                                                  Binary binaryValue,
                                                  boolean imageParsedUsingDefaultMetadata ) throws Exception {
        try (InputStream stream = binaryValue.getStream()) {
            Metadata advancedMetadata = ImageMetadataReader.readMetadata(new BufferedInputStream(stream), false);
            ExifIFD0Directory exifIFD0Directory = advancedMetadata.getDirectory(ExifIFD0Directory.class);
            if (exifIFD0Directory == null || !hasTags(exifIFD0Directory, EXIF_TAGS)) {
                if (!imageParsedUsingDefaultMetadata) {
                    getLogger().info("Neither default nor advanced metadata parser can resolve image. Ignoring sequencing");
                }
                getLogger().debug("No relevant IFD0 information found, ignoring EXIF node.");
View Full Code Here

TOP

Related Classes of com.drew.metadata.exif.ExifIFD0Directory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.