Apache Sanselan (ApacheCon US 2007 FFT)
Click here to load reader
-
Upload
carsten-ziegeler -
Category
Business
-
view
1.407 -
download
1
description
Transcript of Apache Sanselan (ApacheCon US 2007 FFT)
![Page 1: Apache Sanselan (ApacheCon US 2007 FFT)](https://reader038.fdocuments.us/reader038/viewer/2022100420/554f78c2b4c905435d8b45dc/html5/thumbnails/1.jpg)
Apache Sanselan
![Page 2: Apache Sanselan (ApacheCon US 2007 FFT)](https://reader038.fdocuments.us/reader038/viewer/2022100420/554f78c2b4c905435d8b45dc/html5/thumbnails/2.jpg)
• A pure-Java image library• Reading and writing of images• Support for various image formats• Extracting image meta information
2
Apache Sanselan
![Page 3: Apache Sanselan (ApacheCon US 2007 FFT)](https://reader038.fdocuments.us/reader038/viewer/2022100420/554f78c2b4c905435d8b45dc/html5/thumbnails/3.jpg)
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
![Page 4: Apache Sanselan (ApacheCon US 2007 FFT)](https://reader038.fdocuments.us/reader038/viewer/2022100420/554f78c2b4c905435d8b45dc/html5/thumbnails/4.jpg)
Features of Sanselan
4
• Portable toolkit (pure Java)• Correctness over performance• Not tied to files
– Byte arrays, input streams
• Simple but powerful API
![Page 5: Apache Sanselan (ApacheCon US 2007 FFT)](https://reader038.fdocuments.us/reader038/viewer/2022100420/554f78c2b4c905435d8b45dc/html5/thumbnails/5.jpg)
Features of Sanselan
• File format identification• Fast extraction (without reading the image
data) of – image info– icc profile– image metadata
• Reading and writing
![Page 6: Apache Sanselan (ApacheCon US 2007 FFT)](https://reader038.fdocuments.us/reader038/viewer/2022100420/554f78c2b4c905435d8b45dc/html5/thumbnails/6.jpg)
Supported Formats
• PNG• GIF• TIFF (EXIF support)• BMP• PNM/PGM/PBM/PPM• ICO, PSD/Photoshop (read only)• JPEG (read only) – EXIF support
![Page 7: Apache Sanselan (ApacheCon US 2007 FFT)](https://reader038.fdocuments.us/reader038/viewer/2022100420/554f78c2b4c905435d8b45dc/html5/thumbnails/7.jpg)
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);
![Page 8: Apache Sanselan (ApacheCon US 2007 FFT)](https://reader038.fdocuments.us/reader038/viewer/2022100420/554f78c2b4c905435d8b45dc/html5/thumbnails/8.jpg)
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("Grayscale image.");if (image_info.getHeight() > 1000)
System.out.println("Large image.");
![Page 9: Apache Sanselan (ApacheCon US 2007 FFT)](https://reader038.fdocuments.us/reader038/viewer/2022100420/554f78c2b4c905435d8b45dc/html5/thumbnails/9.jpg)
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);
![Page 10: Apache Sanselan (ApacheCon US 2007 FFT)](https://reader038.fdocuments.us/reader038/viewer/2022100420/554f78c2b4c905435d8b45dc/html5/thumbnails/10.jpg)
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
![Page 11: Apache Sanselan (ApacheCon US 2007 FFT)](https://reader038.fdocuments.us/reader038/viewer/2022100420/554f78c2b4c905435d8b45dc/html5/thumbnails/11.jpg)
Q&A