Examples of JpegDirectory


Examples of com.drew.metadata.jpeg.JpegDirectory

            if (dimension != null && !dimension.equals(0)) {
                return dimension;
            }
        }

        JpegDirectory jpegDir = metadata.getDirectory(JpegDirectory.class);
        if (jpegDir != null) {
            Integer dimension = jpegDir.getInteger(jpegDimensionTag);
            if (dimension != null && !dimension.equals(0)) {
                return dimension;
            }
        }
View Full Code Here

Examples of com.drew.metadata.jpeg.JpegDirectory

    }

    public Dimension readJPEGDimension(File f) throws IOException{
        Dimension result = null;
        try{
            JpegDirectory meta = (JpegDirectory)
                (new JpegReader(f)).extract().getDirectory(JpegDirectory.class);
            if(
                meta != null &&
                meta.containsTag(JpegDirectory.TAG_JPEG_IMAGE_HEIGHT) &&
                meta.containsTag(JpegDirectory.TAG_JPEG_IMAGE_WIDTH)
            ){
                int height = meta.getInt(JpegDirectory.TAG_JPEG_IMAGE_HEIGHT);
                int width =  meta.getInt(JpegDirectory.TAG_JPEG_IMAGE_WIDTH);
                result = new Dimension(width, height);
            }
        } catch (JpegProcessingException ex){
            throw toIOException(ex, f);
        } catch (MetadataException ex){
View Full Code Here

Examples of com.drew.metadata.jpeg.JpegDirectory

        super(s);
    }

    public void setUp()
    {
        _directory = new JpegDirectory();
    }
View Full Code Here

Examples of com.drew.metadata.jpeg.JpegDirectory

        super(s);
    }

    public void setUp() throws Exception
    {
        _directory = new JpegDirectory();
        _descriptor = new JpegDescriptor(_directory);
    }
View Full Code Here

Examples of com.drew.metadata.jpeg.JpegDirectory

                continue;
            // Should never have more than one SOFn for a given 'n'.
            byte[] jpegSegment = segmentReader.getSegment((byte)(JpegSegmentReader.SEGMENT_SOF0 + i));
            if (jpegSegment == null)
                continue;
            JpegDirectory directory = metadata.getOrCreateDirectory(JpegDirectory.class);
            directory.setInt(JpegDirectory.TAG_JPEG_COMPRESSION_TYPE, i);
            new JpegReader().extract(new ByteArrayReader(jpegSegment), metadata);
            break;
        }

        // There should never be more than one COM segment.
View Full Code Here

Examples of com.drew.metadata.jpeg.JpegDirectory

      //        for (Tag tag : directory.getTags()) {
      //          cfg.getCtxt().log("" + tag);
      //        }
      //      }
      // retrieve jpeg tags if any
      JpegDirectory jpegDir = metadata.getDirectory(JpegDirectory.class);
      ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
      try {
        imgData.addParameter(Configuration.heigthParam, jpegDir.getImageHeight());
        imgData.addParameter(Configuration.widthParam, jpegDir.getImageWidth());
      }
      catch (MetadataException ex1) {
        imgData.addParameter(Configuration.heigthParam, exifDir.getInteger(ExifSubIFDDirectory.TAG_EXIF_IMAGE_HEIGHT ));
        imgData.addParameter(Configuration.widthParam, exifDir.getInteger(ExifSubIFDDirectory.TAG_EXIF_IMAGE_WIDTH ));
      }
View Full Code Here

Examples of com.drew.metadata.jpeg.JpegDirectory

      //        for (Tag tag : directory.getTags()) {
      //          cfg.getCtxt().log("" + tag);
      //        }
      //      }
      // retrieve jpeg tags if any
      JpegDirectory jpegDir = metadata.getDirectory(JpegDirectory.class);
      ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
      try {
        imgData.addParameter(Configuration.heigthParam, jpegDir.getImageHeight());
        imgData.addParameter(Configuration.widthParam, jpegDir.getImageWidth());
      }
      catch (MetadataException ex1) {
        imgData.addParameter(Configuration.heigthParam, exifDir.getInteger(ExifSubIFDDirectory.TAG_EXIF_IMAGE_HEIGHT ));
        imgData.addParameter(Configuration.widthParam, exifDir.getInteger(ExifSubIFDDirectory.TAG_EXIF_IMAGE_WIDTH ));
      }
View Full Code Here

Examples of com.drew.metadata.jpeg.JpegDirectory

      //        for (Tag tag : directory.getTags()) {
      //          cfg.getCtxt().log("" + tag);
      //        }
      //      }
      // retrieve jpeg tags if any
      JpegDirectory jpegDir = metadata.getDirectory(JpegDirectory.class);
      ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
      try {
        imgData.addParameter(Configuration.heigthParam, jpegDir.getImageHeight());
        imgData.addParameter(Configuration.widthParam, jpegDir.getImageWidth());
      }
      catch (MetadataException ex1) {
        imgData.addParameter(Configuration.heigthParam, exifDir.getInteger(ExifSubIFDDirectory.TAG_EXIF_IMAGE_HEIGHT ));
        imgData.addParameter(Configuration.widthParam, exifDir.getInteger(ExifSubIFDDirectory.TAG_EXIF_IMAGE_WIDTH ));
      }
View Full Code Here

Examples of com.drew.metadata.jpeg.JpegDirectory

      //        for (Tag tag : directory.getTags()) {
      //          cfg.getCtxt().log("" + tag);
      //        }
      //      }
      // retrieve jpeg tags if any
      JpegDirectory jpegDir = metadata.getDirectory(JpegDirectory.class);
      ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
      try {
        imgData.addParameter(Configuration.heigthParam, jpegDir.getImageHeight());
        imgData.addParameter(Configuration.widthParam, jpegDir.getImageWidth());
      }
      catch (MetadataException ex1) {
        imgData.addParameter(Configuration.heigthParam, exifDir.getInteger(ExifSubIFDDirectory.TAG_EXIF_IMAGE_HEIGHT ));
        imgData.addParameter(Configuration.widthParam, exifDir.getInteger(ExifSubIFDDirectory.TAG_EXIF_IMAGE_WIDTH ));
      }
View Full Code Here

Examples of com.drew.metadata.jpeg.JpegDirectory

                continue;
            // Should never have more than one SOFn for a given 'n'.
            byte[] jpegSegment = segmentReader.getSegment((byte)(JpegSegmentReader.SEGMENT_SOF0 + i));
            if (jpegSegment == null)
                continue;
            JpegDirectory directory = metadata.getOrCreateDirectory(JpegDirectory.class);
            directory.setInt(JpegDirectory.TAG_JPEG_COMPRESSION_TYPE, i);
            new JpegReader().extract(new ByteArrayReader(jpegSegment), metadata);
            break;
        }

        // There should never be more than one COM segment.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.