Examples of JpegSegmentReader


Examples of com.drew.imaging.jpeg.JpegSegmentReader

                throw new Parser.Failure(e.getMessage(), location);
            }

            ii = parseJavaImage(location, new ByteArrayInputStream(b));
           
            JpegSegmentReader segmentReader;
            try {
                segmentReader = new JpegSegmentReader(new ByteArrayInputStream(b));

                byte[] exifSegment = segmentReader.readSegment(JpegSegmentReader.SEGMENT_APP1);
                byte[] iptcSegment = segmentReader.readSegment(JpegSegmentReader.SEGMENT_APPD);
                Metadata metadata = new Metadata();
                new ExifReader(exifSegment).extract(metadata);
                new IptcReader(iptcSegment).extract(metadata);
               
                @SuppressWarnings("unchecked")
View Full Code Here

Examples of com.drew.imaging.jpeg.JpegSegmentReader

        ExifDirectory exifDirectory = (ExifDirectory)metadata.getDirectory(ExifDirectory.class);
        assertTrue(exifDirectory.containsTag(ExifDirectory.TAG_THUMBNAIL_DATA));
        byte[] thumbData = exifDirectory.getThumbnailData();
        try {
            // attempt to read the thumbnail -- it should be a legal Jpeg file
            new JpegSegmentReader(thumbData);
        } catch (JpegProcessingException e) {
            fail("Unable to construct JpegSegmentReader from thumbnail data");
        }
    }
View Full Code Here

Examples of com.drew.imaging.jpeg.JpegSegmentReader

     * @param file
     * @throws JpegProcessingException
     */
    public ExifReader(File file) throws JpegProcessingException
    {
        this(new JpegSegmentReader(file).readSegment(JpegSegmentReader.SEGMENT_APP1));
    }
View Full Code Here

Examples of com.drew.imaging.jpeg.JpegSegmentReader

     * Creates an ExifReader for a Jpeg stream.
     * @param is JPEG stream. Stream will be closed.
     */
    public ExifReader(InputStream is) throws JpegProcessingException
    {
        this(new JpegSegmentReader(is).readSegment(JpegSegmentReader.SEGMENT_APP1));
    }
View Full Code Here

Examples of com.drew.imaging.jpeg.JpegSegmentReader

    /**
     * Creates a new JpegReader for the specified Jpeg jpegFile.
     */
    public JpegReader(File jpegFile) throws JpegProcessingException
    {
        this(new JpegSegmentReader(jpegFile).readSegment(JpegSegmentReader.SEGMENT_SOF0));
    }
View Full Code Here

Examples of com.drew.imaging.jpeg.JpegSegmentReader

     *
     * @param is JPEG stream. Stream will be closed.
     */
    public JpegReader(InputStream is) throws JpegProcessingException
    {
        this(new JpegSegmentReader(is).readSegment(JpegSegmentReader.SEGMENT_APPD));
    }
View Full Code Here

Examples of com.drew.imaging.jpeg.JpegSegmentReader

    /**
     * Creates a new JpegReader for the specified Jpeg jpegFile.
     */
    public JpegCommentReader(File jpegFile) throws JpegProcessingException
    {
        this(new JpegSegmentReader(jpegFile).readSegment(JpegSegmentReader.SEGMENT_COM));
    }
View Full Code Here

Examples of com.drew.imaging.jpeg.JpegSegmentReader

     *
     * @param is JPEG stream. Stream will be closed.
     */
    public JpegCommentReader(InputStream is) throws JpegProcessingException
    {
        this(new JpegSegmentReader(is).readSegment(JpegSegmentReader.SEGMENT_APPD));
    }
View Full Code Here

Examples of com.drew.imaging.jpeg.JpegSegmentReader

        // Approach 3
        // As fast as approach 1 (this is what goes on inside the JpegMetadataReader's
        // readMetadata() method), this code is handy if you want to look into other
        // Jpeg segments too.
        try {
            JpegSegmentReader segmentReader = new JpegSegmentReader(jpegFile);
            byte[] exifSegment = segmentReader.readSegment(JpegSegmentReader.SEGMENT_APP1);
            byte[] iptcSegment = segmentReader.readSegment(JpegSegmentReader.SEGMENT_APPD);
            Metadata metadata = new Metadata();
            new ExifReader(exifSegment).extract(metadata);
            new IptcReader(iptcSegment).extract(metadata);
            printImageTags(3, metadata);
        } catch (JpegProcessingException jpe) {
View Full Code Here

Examples of com.drew.imaging.jpeg.JpegSegmentReader

public class SpecialTests extends TestCase
{
    public void testExtractMetadataToASeparateFile() throws Exception
    {
        String filename = "src/com/drew/metadata/exif/test/nikonMakernoteType2";
        JpegSegmentData segmentData = new JpegSegmentReader(new File(filename + ".jpg")).getSegmentData();
        segmentData.removeSegment(JpegSegmentReader.SEGMENT_DHT);
        segmentData.removeSegment(JpegSegmentReader.SEGMENT_DQT);
        segmentData.removeSegment(JpegSegmentReader.SEGMENT_SOF0);
        segmentData.removeSegment(JpegSegmentReader.SEGMENT_SOI);
        ObjectOutputStream outputStream = null;
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.