Android Open Source - PictureMap Jpeg Directory






From Project

Back to project page PictureMap.

License

The source code is released under:

GNU General Public License

If you think the Android project PictureMap listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * This is public domain software - that is, you can do whatever you want
 * with it, and include it software that is licensed under the GNU or the
 * BSD license, or whatever other licence you choose, including proprietary
 * closed source licenses.  I do ask that you leave this header in tact.
 *//w  ww.ja v  a  2s .  c  o m
 * If you make modifications to this code that you think would benefit the
 * wider community, please send me a copy and I'll post it on my site.
 *
 * If you make use of this code, I'd appreciate hearing about it.
 *   drew@drewnoakes.com
 * Latest version of this software kept at
 *   http://drewnoakes.com/
 *
 * Created on Aug 2, 2003.
 */
package com.drewChanged.metadata.jpeg;

import com.drewChanged.metadata.Directory;
import com.drewChanged.metadata.MetadataException;

import java.util.Hashtable;

/**
 * Directory of tags and values for the SOF0 Jpeg segment.  This segment holds basic metadata about the image.
 * @author Darrell Silver http://www.darrellsilver.com and Drew Noakes
 */
@SuppressWarnings("unchecked")
public class JpegDirectory extends Directory {

  /** This is in bits/sample, usually 8 (12 and 16 not supported by most software). */
  public static final int TAG_JPEG_DATA_PRECISION = 0;
  /** The image's height.  Necessary for decoding the image, so it should always be there. */
  public static final int TAG_JPEG_IMAGE_HEIGHT = 1;
  /** The image's width.  Necessary for decoding the image, so it should always be there. */
  public static final int TAG_JPEG_IMAGE_WIDTH = 3;
  /** Usually 1 = grey scaled, 3 = color YcbCr or YIQ, 4 = color CMYK
   * Each component TAG_COMPONENT_DATA_[1-4], has the following meaning:
   * component Id(1byte)(1 = Y, 2 = Cb, 3 = Cr, 4 = I, 5 = Q),
   * sampling factors (1byte) (bit 0-3 vertical., 4-7 horizontal.),
   * quantization table number (1 byte).
   * <p>
   * This info is from http://www.funducode.com/freec/Fileformats/format3/format3b.htm
   */
  public static final int TAG_JPEG_NUMBER_OF_COMPONENTS = 5;

    // NOTE!  Component tag type int values must increment in steps of 1

  /** the first of a possible 4 color components.  Number of components specified in TAG_JPEG_NUMBER_OF_COMPONENTS.*/
  public static final int TAG_JPEG_COMPONENT_DATA_1 = 6;
  /** the second of a possible 4 color components.  Number of components specified in TAG_JPEG_NUMBER_OF_COMPONENTS.*/
  public static final int TAG_JPEG_COMPONENT_DATA_2 = 7;
  /** the third of a possible 4 color components.  Number of components specified in TAG_JPEG_NUMBER_OF_COMPONENTS.*/
  public static final int TAG_JPEG_COMPONENT_DATA_3 = 8;
  /** the fourth of a possible 4 color components.  Number of components specified in TAG_JPEG_NUMBER_OF_COMPONENTS.*/
  public static final int TAG_JPEG_COMPONENT_DATA_4 = 9;

  protected static final Hashtable tagNameMap = new Hashtable();

  static {
        tagNameMap.put(new Integer(TAG_JPEG_DATA_PRECISION), "Data Precision");
        tagNameMap.put(new Integer(TAG_JPEG_IMAGE_WIDTH), "Image Width");
        tagNameMap.put(new Integer(TAG_JPEG_IMAGE_HEIGHT), "Image Height");
    tagNameMap.put(new Integer(TAG_JPEG_NUMBER_OF_COMPONENTS), "Number of Components");
    tagNameMap.put(new Integer(TAG_JPEG_COMPONENT_DATA_1), "Component 1");
    tagNameMap.put(new Integer(TAG_JPEG_COMPONENT_DATA_2), "Component 2");
    tagNameMap.put(new Integer(TAG_JPEG_COMPONENT_DATA_3), "Component 3");
    tagNameMap.put(new Integer(TAG_JPEG_COMPONENT_DATA_4), "Component 4");
  }

    public JpegDirectory() {
    this.setDescriptor(new JpegDescriptor(this));
  }

  public String getName() {
    return "Jpeg";
  }

  protected Hashtable getTagNameMap() {
    return tagNameMap;
  }

    /**
     *
     * @param componentNumber The zero-based index of the component.  This number is normally between 0 and 3.
     *        Use getNumberOfComponents for bounds-checking.
     * @return
     */
    public JpegComponent getComponent(int componentNumber)
    {
        int tagType = JpegDirectory.TAG_JPEG_COMPONENT_DATA_1 + componentNumber;

        JpegComponent component = (JpegComponent)getObject(tagType);

        return component;
    }

    public int getImageWidth() throws MetadataException
    {
        return getInt(JpegDirectory.TAG_JPEG_IMAGE_WIDTH);
    }

    public int getImageHeight() throws MetadataException
    {
        return getInt(JpegDirectory.TAG_JPEG_IMAGE_HEIGHT);
    }

    public int getNumberOfComponents() throws MetadataException
    {
        return getInt(JpegDirectory.TAG_JPEG_NUMBER_OF_COMPONENTS);
    }
}




Java Source Code List

com.aripollak.picturemap.ImageUtilities.java
com.aripollak.picturemap.MainActivity.java
com.aripollak.picturemap.PictureCallout.java
com.aripollak.picturemap.PopulateMapTask.java
com.drewChanged.imaging.PhotographicConversions.java
com.drewChanged.imaging.jpeg.JpegMetadataReader.java
com.drewChanged.imaging.jpeg.JpegProcessingException.java
com.drewChanged.imaging.jpeg.JpegSegmentData.java
com.drewChanged.imaging.jpeg.JpegSegmentReader.java
com.drewChanged.lang.CompoundException.java
com.drewChanged.lang.NullOutputStream.java
com.drewChanged.lang.Rational.java
com.drewChanged.metadata.DefaultTagDescriptor.java
com.drewChanged.metadata.Directory.java
com.drewChanged.metadata.MetadataException.java
com.drewChanged.metadata.MetadataReader.java
com.drewChanged.metadata.Metadata.java
com.drewChanged.metadata.TagDescriptor.java
com.drewChanged.metadata.Tag.java
com.drewChanged.metadata.exif.DataFormat.java
com.drewChanged.metadata.exif.ExifDescriptor.java
com.drewChanged.metadata.exif.ExifDirectory.java
com.drewChanged.metadata.exif.ExifInteropDescriptor.java
com.drewChanged.metadata.exif.ExifInteropDirectory.java
com.drewChanged.metadata.exif.ExifProcessingException.java
com.drewChanged.metadata.exif.ExifReader.java
com.drewChanged.metadata.exif.GpsDescriptor.java
com.drewChanged.metadata.exif.GpsDirectory.java
com.drewChanged.metadata.iptc.IptcDescriptor.java
com.drewChanged.metadata.iptc.IptcDirectory.java
com.drewChanged.metadata.iptc.IptcProcessingException.java
com.drewChanged.metadata.iptc.IptcReader.java
com.drewChanged.metadata.jpeg.JpegCommentDescriptor.java
com.drewChanged.metadata.jpeg.JpegCommentDirectory.java
com.drewChanged.metadata.jpeg.JpegCommentReader.java
com.drewChanged.metadata.jpeg.JpegComponent.java
com.drewChanged.metadata.jpeg.JpegDescriptor.java
com.drewChanged.metadata.jpeg.JpegDirectory.java
com.drewChanged.metadata.jpeg.JpegReader.java