KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > util > images > JAIImageInformer


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.util.images;
11
12 import java.util.Map JavaDoc;
13 import java.io.*;
14 import javax.media.jai.*;
15
16 import com.sun.media.jai.codec.ByteArraySeekableStream;
17
18 /**
19  * Informs about a image using JAI.
20  *
21  * @author Michiel Meeuwissen
22  * @version $Id: JAIImageInformer.java,v 1.1 2005/05/09 09:53:07 michiel Exp $
23  * @since MMBase-1.8
24  */

25 public class JAIImageInformer implements ImageInformer {
26
27     public void init(Map JavaDoc params) {
28     }
29
30     public Dimension getDimension(byte[] input) throws IOException {
31         ByteArraySeekableStream bin = new ByteArraySeekableStream(input);
32         PlanarImage img = JAI.create("stream", bin);
33         return new Dimension(img.getWidth(), img.getHeight());
34
35     }
36 }
37
Popular Tags