Package org.geotools.image

Examples of org.geotools.image.ImageWorker


        // have to add an extra band to the latter type of images for providing
        // alpha information to them.
        //
        //
        if (rasterManager.expandMe && granule.getColorModel() instanceof IndexColorModel) {
            granule = new ImageWorker(granule).forceComponentColorModel()
                    .getRenderedImage();
        }

        //
        // TRANSPARENT COLOR MANAGEMENT
View Full Code Here


        //
        // Reformatting this image for png
        //
        // /////////////////////////////////////////////////////////////////
        final MemoryCacheImageOutputStream memOutStream = new MemoryCacheImageOutputStream(output);
        final ImageWorker worker = new ImageWorker(image);
        final PlanarImage finalImage = (image.getColorModel() instanceof DirectColorModel) ? worker
                .forceComponentColorModel().getPlanarImage() : worker.getPlanarImage();

        // /////////////////////////////////////////////////////////////////
        //
        // Getting a writer
        //
View Full Code Here

        Assert.isInstanceOf(BufferedImageLegendGraphic.class, legend);

        BufferedImage legendGraphic = ((BufferedImageLegendGraphic) legend).getLegend();

        RenderedImage forcedIndexed8Bitmask = ImageUtils.forceIndexed8Bitmask(legendGraphic, null);
        ImageWorker imageWorker = new ImageWorker(forcedIndexed8Bitmask);
        imageWorker.writeGIF(output, "LZW", 0.75f);
    }
View Full Code Here

                // The image is indexed on 8 bits and the color model is
                // Translucent, we have to perform some color operations in
                // order to convert it to bitmask.
                //
                // //
                image = new ImageWorker(originalImage).forceBitmaskIndexColorModel().getRenderedImage();
            }
        } else {
            // /////////////////////////////////////////////////////////////////
            //
            // NOT IndexColorModel and DataBuffer.TYPE_BYTE
            //
            // ///
            //
            // We got an image that needs to be converted.
            //
            // /////////////////////////////////////////////////////////////////
          image = new ImageWorker(originalImage).rescaleToBytes().getRenderedImage();
            if (invColorMap != null) {

                // make me parametric which means make me work with other image
                // types
                image = invColorMap.filterRenderedImage(image);
            } else {
                // //
                //
                // We do not have a paletteInverter, let's create a palette that
                // is as good as possible.
                //
                // //
                // make sure we start from a componentcolormodel.
                image = new ImageWorker(image).forceComponentColorModel().getRenderedImage();

                // //
                //
                // Build the CustomPaletteBuilder doing some good subsampling.
                //
View Full Code Here

            // Storing Image ...
            //
            // /////////////////////////////////////////////////////////////////
            final ZipEntry e = new ZipEntry("layer_" + (i) + ".png");
            outZ.putNextEntry(e);
            new ImageWorker(curImage).writePNG(outZ, "FILTERED", 0.75f, false, false);
            //final MemoryCacheImageOutputStream memOutStream = new MemoryCacheImageOutputStream(outZ);
            /*final PlanarImage encodedImage = PlanarImage
                            .wrapRenderedImage(curImage);
            //final PlanarImage finalImage = encodedImage.getColorModel() instanceof DirectColorModel?ImageUtilities
            //                .reformatColorModel2ComponentColorModel(encodedImage):encodedImage;
View Full Code Here

        // Now the magic
        //
        // /////////////////////////////////////////////////////////////////
        InverseColorMapOp paletteInverter = mapContext.getPaletteInverter();
        RenderedImage renderedImage = super.forceIndexed8Bitmask(originalImage, paletteInverter);
        ImageWorker imageWorker = new ImageWorker(renderedImage);
        imageWorker.writeGIF(outStream, "LZW", 0.75f);
    }
View Full Code Here

        float quality = (100 - wms.getPngCompression()) / 100.0f;
        SampleModel sm = image.getSampleModel();
        int numBits = sm.getSampleSize(0);
        // png acceleration only works on 2 bit and 8 bit images, crashes on 4 bits
        boolean nativeAcceleration = PNGNativeAcc.booleanValue() && !(numBits > 1 && numBits < 8);;
        new ImageWorker(image).writePNG(outStream, "FILTERED", quality,
                nativeAcceleration, image.getColorModel() instanceof IndexColorModel);

        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.fine("Writing png image ... done!");
        }
View Full Code Here

            LOGGER.fine("About to write a JPEG image.");
        }

        boolean JPEGNativeAcc = wms.getJPEGNativeAcceleration() && CODEC_LIB_AVAILABLE;
        float quality = (100 - wms.getJpegCompression()) / 100.0f;
        ImageWorker iw = new ImageWorker(image);
        iw.writeJPEG(outStream, "JPEG", quality, JPEGNativeAcc);

        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.fine("Writing a JPEG done!!!");
        }
    }
View Full Code Here

        final boolean tiled= tileWidth!=renderedImage.getWidth()&& tileHeight!=renderedImage.getHeight();
       
        // ok, encode in geotiff
        if(unreferenced) {
            if(tiled){
                new ImageWorker(renderedImage).writeTIFF(os, null, 0.75f, tileWidth, tileHeight);
            } else {

                final Dimension defaultTileSize = JAI.getDefaultTileSize();
                new ImageWorker(renderedImage).writeTIFF(os, null, 0.75f, defaultTileSize.width,  defaultTileSize.height);
            }
        } else {
            GeoTiffFormat format = new GeoTiffFormat();
            final GeoTiffWriteParams wp = new GeoTiffWriteParams();
View Full Code Here

            Boolean PNGNativeAcc = (encoder == JAIInfo.PngEncoderType.NATIVE);
            SampleModel sm = image.getSampleModel();
            int numBits = sm.getSampleSize(0);
            // png acceleration only works on 2 bit and 8 bit images, crashes on 4 bits
            boolean nativeAcceleration = PNGNativeAcc.booleanValue() && !(numBits > 1 && numBits < 8);
            ImageWorker iw = new ImageWorker(image);
            iw.writePNG(outStream, "FILTERED", quality, nativeAcceleration, false);
            RasterCleaner.addImage(iw.getRenderedImage());           
        }

        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.fine("Writing png image ... done!");
        }
View Full Code Here

TOP

Related Classes of org.geotools.image.ImageWorker

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.