Package javax.imageio

Examples of javax.imageio.ImageReader


        BodyPart coveragePart = multipart.getBodyPart(1);
        assertEquals("image/tiff", coveragePart.getContentType());
        assertEquals("<theCoverage>", coveragePart.getHeader("Content-ID")[0]);

        // make sure we can read the coverage back
        ImageReader reader = ImageIO.getImageReadersByFormatName("tiff").next();
        reader.setInput(ImageIO.createImageInputStream(coveragePart.getInputStream()));
        reader.read(0);
    }
View Full Code Here


        BodyPart coveragePart = multipart.getBodyPart(1);
        assertEquals("image/png", coveragePart.getContentType());
        assertEquals("<theCoverage>", coveragePart.getHeader("Content-ID")[0]);

        // make sure we can read the coverage back
        ImageReader reader = ImageIO.getImageReadersByFormatName("png").next();
        reader.setInput(ImageIO.createImageInputStream(coveragePart.getInputStream()));
        reader.read(0);
    }
View Full Code Here

    File file = new File(IMAGE_FILENAME);
    System.out.println("File exists: "+file.exists());
    Iterator<ImageReader> irList = ImageIO.getImageReaders(ImageIO.createImageInputStream(file));
//    Iterator<ImageReader> irList = ImageIO.getImageReadersByFormatName("jpeg");
    while(irList.hasNext()) {
      ImageReader ir = irList.next();

      System.out.println("Total Memory: "+Runtime.getRuntime().totalMemory());
      System.out.println("Max Memory: "+Runtime.getRuntime().maxMemory());
      System.out.println("Free Memory: "+Runtime.getRuntime().freeMemory());
     
      ir.setInput(ImageIO.createImageInputStream(file));
     
      System.out.println("Found ImageReader: "+ir);
      System.out.println("Tile Width: "+ir.getTileWidth(0));
      System.out.println("Tile Height: "+ir.getTileHeight(0));
     
      System.out.println("Total Memory: "+Runtime.getRuntime().totalMemory());
      System.out.println("Max Memory: "+Runtime.getRuntime().maxMemory());
      System.out.println("Free Memory: "+Runtime.getRuntime().freeMemory());
    }
View Full Code Here

            throws Exception {

        InputStream stream = TestUtilities.doImageTranscodeTest(
                expectations, rule, fileName, parameters, enableGif);

        ImageReader reader = null;
        ParameterBlockJAI pblock = new ParameterBlockJAI("ImageRead");
        pblock.setParameter("Input", ImageIO.createImageInputStream(stream));
        if (rule.equals(OutputImageRules.WBMP)) {
            // wbmps do not have a magic number so
            // ImageRead operation cannot recognize them.
View Full Code Here

                                         {"v.width", String.valueOf(width)},
                                         {"v.scaleLarger", scaleLarger}},
                                     true);


        ImageReader reader = null;
        if (rule.equals(OutputImageRules.WBMP)) {
            // wbmps do not have a magic number so ImageRead operation cannot
            // load them.
            reader = ImageIO.getImageReadersByFormatName("wbmp").next();
        }
View Full Code Here

                                     {"v.width", String.valueOf(width)},
                                     {"v.p",
                                      getProtectedArea(width, clipMode)}},
                                 true);

        ImageReader reader = null;
        if (rule.equals(OutputImageRules.WBMP)) {
            // wbmps do not have a magic number so ImageRead operation cannot
            // load them.
            reader = ImageIO.getImageReadersByFormatName("wbmp").next();
        }
View Full Code Here

        }
      } else {
        ImageInputStream iis = ImageIO.createImageInputStream(file);
                final Iterator it = ImageIO.getImageReaders(iis);
        if (it.hasNext()) {
          final ImageReader reader = (ImageReader) it.next();
          reader.setInput(iis);
          final ColorModel cm = ((ImageTypeSpecifier) reader
              .getImageTypes(0).next()).getColorModel();
          if (cm instanceof IndexColorModel) {
            final IndexColorModel icm = (IndexColorModel) cm;
            final InverseColorMapOp eicm = new InverseColorMapOp(
                icm);
View Full Code Here

        String type = metadata.get(Metadata.CONTENT_TYPE);
        if (type != null) {
            Iterator<ImageReader> iterator =
                ImageIO.getImageReadersByMIMEType(type);
            if (iterator.hasNext()) {
                ImageReader reader = iterator.next();
                reader.setInput(ImageIO.createImageInputStream(
                        new CloseShieldInputStream(stream)));
                metadata.set("height", Integer.toString(reader.getHeight(0)));
                metadata.set("width", Integer.toString(reader.getWidth(0)));
                reader.dispose();
            }
        }

        XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata);
        xhtml.startDocument();
View Full Code Here

        if (type != null) {
            try {
                Iterator<ImageReader> iterator =
                    ImageIO.getImageReadersByMIMEType(type);
                if (iterator.hasNext()) {
                    ImageReader reader = iterator.next();
                    reader.setInput(ImageIO.createImageInputStream(
                            new CloseShieldInputStream(stream)));
                   
                    metadata.set(Metadata.IMAGE_WIDTH, Integer.toString(reader.getWidth(0)));
                    metadata.set(Metadata.IMAGE_LENGTH, Integer.toString(reader.getHeight(0)));
                    metadata.set("height", Integer.toString(reader.getHeight(0)));
                    metadata.set("width", Integer.toString(reader.getWidth(0)));

                    loadMetadata(reader.getImageMetadata(0), metadata);

                    reader.dispose();
                }
               
                // Translate certain Metadata tags from the ImageIO
                //  specific namespace into the general Tika one
                setIfPresent(metadata, "CommentExtensions CommentExtension", Metadata.COMMENTS);
View Full Code Here

      }catch(Exception e){
        sender.sendMessage("please specify the number, and not the name of the alignment(the first sign in each line)");
        return true;
      }
      Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName("gif");
      ImageReader reader = readers.next();
      ImageInputStream iis=null;
      try {
        iis = ImageIO.createImageInputStream(new File(savePath + args[0]));
      }catch(FileNotFoundException e){
        sender.sendMessage("input file not found");
        return true;
      } catch (IOException e) {}
      reader.setInput(iis);
      LinkedList<Frame> frames = new LinkedList<Frame>();
      for(int i =0;true;i++){
        try {
          BufferedImage bi = reader.read(i);
          frames.add(new Frame(bi,Alignment.values()[Integer.parseInt(args[2])]));
        } catch (IndexOutOfBoundsException e){
          break;
        } catch (IOException e) {}
      }
View Full Code Here

TOP

Related Classes of javax.imageio.ImageReader

Copyright © 2018 www.massapicom. 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.