Package com.sun.media.imageioimpl.plugins.jpeg2000

Examples of com.sun.media.imageioimpl.plugins.jpeg2000.BitsPerComponentBox


    //adding a phatom dirty green background color to textures
    BufferedImage bitmap = pngTransformation(((BitmapBufferedImageImpl)inputbitmap).getImage());
//    BufferedImage bitmap = ((BitmapBufferedImageImpl)inputbitmap).getImage();
   
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    J2KImageWriter writer = (J2KImageWriter) ImageIO.getImageWritersByFormatName("jpeg2000").next();
    J2KImageWriteParam iwp = (J2KImageWriteParam)writer.getDefaultWriteParam();
   
    iwp.setLossless(lossless);
////    //list of all types, only one seems to exist
//    String[] ct = iwp.getCompressionTypes();
//    for(int i=0;i < ct.length; i++)
//      System.out.println("compression type : "+ct[0]);
//   
    iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
//    iwp.setCompressionType(ct[0]);
//    iwp.setCompressionQuality(0.01f);
////    iwp.setEncodingRate(0.01);
    //TODO Experiment
    iwp.setFilter(J2KImageWriteParam.FILTER_97);
    iwp.setProgressionType("layer");
    //Following is must to generate j2k JPEG 2000 stream
    iwp.setWriteCodeStreamOnly(true);
   
    iwp.setNumDecompositionLevels(5);
    FileCacheImageOutputStream fileImageOutputStream = new FileCacheImageOutputStream(baos, null);
    writer.setOutput(fileImageOutputStream);

    //TODO changed
//    writer.write(null, new IIOImage(bitmap, null, null), iwp);
//    IIOMetadata metadata = writer.getDefaultImageMetadata(new ImageTypeSpecifier(bitmap), iwp);
    J2KMetadata metadata = new J2KMetadata(bitmap.getColorModel(),
        bitmap.getSampleModel(), bitmap.getWidth(), bitmap.getHeight(), iwp, writer);
    writer.write(metadata, new IIOImage(bitmap, null, null), iwp);
//    writer.write(bitmap);
   
    fileImageOutputStream.flush();
    fileImageOutputStream.close();
//    ImageIO.write((BitmapBufferedImageImpl)bitmap, "jpg2000", baos);
View Full Code Here


    writer.setOutput(fileImageOutputStream);

    //TODO changed
//    writer.write(null, new IIOImage(bitmap, null, null), iwp);
//    IIOMetadata metadata = writer.getDefaultImageMetadata(new ImageTypeSpecifier(bitmap), iwp);
    J2KMetadata metadata = new J2KMetadata(bitmap.getColorModel(),
        bitmap.getSampleModel(), bitmap.getWidth(), bitmap.getHeight(), iwp, writer);
    writer.write(metadata, new IIOImage(bitmap, null, null), iwp);
//    writer.write(bitmap);
   
    fileImageOutputStream.flush();
View Full Code Here

                }
                lut[c][n] = (byte)val;
            }
        }
        if (metadata != null) {
            metadata.addNode(new PaletteBox(length, compSize, lut));
        }
    }
View Full Code Here

     */
    public void readResolutionBox(int type, int length)throws IOException {
        byte[] data = new byte[length];
        in.readFully(data, 0, length);
        if (metadata != null) {
            metadata.addNode(new ResolutionBox(type, data));
        }
    }
View Full Code Here

                codeStreamPos.addElement(new Integer(pos));
                return;
            }

            if (metadata != null)
                metadata.addNode(new SignatureBox());

            // Read all remaining boxes
            while(!lastBoxFound){
                pos = in.getPos();
                length = in.readInt();
View Full Code Here

     */
    public void readUUIDBox(int length) throws IOException {
        if (metadata != null) {
            byte[] data = new byte[length];
            in.readFully(data, 0, length);
            metadata.addNode(new UUIDBox(data));
        }
    }
View Full Code Here

     * */
    public void readUUIDListBox(int length) throws IOException {
        if (metadata != null) {
            byte[] data = new byte[length];
            in.readFully(data, 0, length);
            metadata.addNode(new UUIDListBox(data));
        }
    }
View Full Code Here

     */
    public void readXMLBox(int length) throws IOException {
        if (metadata != null) {
            byte[] data = new byte[length];
            in.readFully(data, 0, length);
            metadata.addNode(new XMLBox(data));
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.media.imageioimpl.plugins.jpeg2000.BitsPerComponentBox

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.