Apache Con Us2007 Sanselan
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
2,464
On Slideshare
2,438
From Embeds
26
Number of Embeds
2

Actions

Shares
Downloads
6
Comments
0
Likes
0

Embeds 26

http://dev.day.com 25
http://www.slideshare.net 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Apache Sanselan
  • 2. Apache Sanselan • A pure-Java image library • Reading and writing of images • Support for various image formats • Extracting image meta information 2
  • 3. History of Sanselan • Initiated by Charles M. Chen in 2004 • Open source since 2004 – Apache Licence • Stable code base • Used by several projects • Entered incubator in September 3
  • 4. Features of Sanselan • Portable toolkit (pure Java) • Correctness over performance • Not tied to files – Byte arrays, input streams • Simple but powerful API 4
  • 5. Features of Sanselan • File format identification • Fast extraction (without reading the image data) of – image info – icc profile – image metadata • Reading and writing
  • 6. Supported Formats PNG • GIF • • TIFF (EXIF support) • BMP • PNM/PGM/PBM/PPM • ICO, PSD/Photoshop (read only) • JPEG (read only) – EXIF support
  • 7. Code Samples // how to read an image: byte imageBytes[] = someBytes; BufferedImage image_1 = Sanselan.getBufferedImage(imageBytes); // Write an image. BufferedImage image = someImage; File dst = someFile; ImageFormat format = ImageFormat.IMAGE_FORMAT_PNG; Map optional_params = new Hashtable(); Sanselan.write(image, dst, format, optional_params);
  • 8. Code Samples // get the image's width and height. Dimension d = Sanselan.getImageSize(imageBytes); // get all of the image's info (ie. bits per pixel, size, // transparency, etc.) ImageInfo image_info = Sanselan.getImageInfo(imageBytes); if (image_info.getColorType() == ImageInfo.COLOR_TYPE_GRAYSCALE) System.out.println(quot;Grayscale image.quot;); if (image_info.getHeight() > 1000) System.out.println(quot;Large image.quot;);
  • 9. Code Samples // try to guess the image's format. ImageFormat image_format = Sanselan.guessFormat(imageBytes); image_format.equals( ImageFormat.IMAGE_FORMAT_PNG); // get all metadata stored in EXIF format // (ie. from JPEG or TIFF). IImageMetadata metdata = Sanselan.getMetadata(imageBytes);
  • 10. Sanselan Today – Check It Out • Code base is in SVN – Buildable with Maven 2 • Paper work is finished • Website is set up – Documentation will follow soon :) • Incubator release (stable code base) soon • Future: growth – features and community 10
  • 11. Q&A