Refine search
/** * The BandMerge operation takes indexed images and expands them, however in the context of * coverage view band merging we don't normally want that, e.g., raster mask bands are * represented as indexed but we really want to keep them in their binary, single band form. To * do so, the IndexColorModel is replaced by a ComponentColorModel * * @param coverage * @return */ private GridCoverage2D prepareForBandMerge(GridCoverage2D coverage) { RenderedImage ri = coverage.getRenderedImage(); SampleModel sampleModel = ri.getSampleModel(); if (sampleModel.getNumBands() == 1 && ri.getColorModel() instanceof IndexColorModel) { ImageWorker worker = new ImageWorker(ri); worker.removeIndexColorModel(); RenderedImage formatted = worker.getRenderedImage(); return new GridCoverageFactory() .create( coverage.getName(), formatted, coverage.getGridGeometry(), coverage.getSampleDimensions(), new GridCoverage[] {coverage}, coverage.getProperties()); } return coverage; }
defaultCM = sampleImage.getColorModel(); defaultSM = sampleImage.getSampleModel(); if (defaultCM instanceof IndexColorModel) { defaultPalette = Utils.extractPalette((IndexColorModel) defaultCM);
image2 = normalizeImage(image2); this.bands = image1.getSampleModel().getNumBands(); final boolean hasAlpha = image1.getColorModel().hasAlpha(); if (bands > 4 || (bands == 2 && !hasAlpha) || (bands == 3 && hasAlpha)) { throw new IllegalArgumentException(
private GridSampleDimension[] getSampleDimensions(final RenderedImage coverageRaster) throws IOException { GridSampleDimension[] bands = rasterInfo.getGridSampleDimensions(); // may the image have been promoted? build the correct band info then final int imageBands = coverageRaster.getSampleModel().getNumBands(); if (bands.length == 1 && imageBands > 1) { LOGGER.fine( coverageName + " was promoted from 1 to " + coverageRaster.getSampleModel().getNumBands() + " bands, returning an appropriate set of GridSampleDimension"); // stolen from super.createCoverage: final ColorModel cm = coverageRaster.getColorModel(); bands = new GridSampleDimension[imageBands]; // setting bands names. for (int i = 0; i < imageBands; i++) { final ColorInterpretation colorInterpretation; colorInterpretation = TypeMap.getColorInterpretation(cm, i); if (colorInterpretation == null) { throw new IOException("Unrecognized sample dimension type"); } bands[i] = new GridSampleDimension(colorInterpretation.name()); } } return bands; }
Errors.format(ErrorKeys.NULL_ARGUMENT_$1, "transparentColor")); final ColorModel cm = image.getColorModel(); if (cm instanceof IndexColorModel) { return maskIndexColorModel(transparentColor); } else if (cm instanceof ComponentColorModel) { switch (image.getSampleModel().getDataType()) { case DataBuffer.TYPE_BYTE:
ColorModel cm = image.getColorModel(); final boolean hasAlpha = cm.hasAlpha(); forceComponentColorModel(); cm = image.getColorModel(); cm = image.getColorModel(); final int numBands = image.getSampleModel().getNumBands(); if (hasAlpha) { retainBands(numBands - 1); final BufferedImage finalImage = new BufferedImage( image.getColorModel(), ((WritableRaster) image.getData()) .createWritableTranslatedChild(0, 0), image.getColorModel().isAlphaPremultiplied(), null);
private GridCoverage2D prepareCoverage(RenderedImage image) throws IOException { // creating bands final SampleModel sm = image.getSampleModel(); final ColorModel cm = image.getColorModel(); final int numBands = sm.getNumBands(); final GridSampleDimension[] bands = new GridSampleDimension[numBands]; // setting bands names. for (int i = 0; i < numBands; i++) { final ColorInterpretation colorInterpretation = TypeMap.getColorInterpretation(cm, i); if (colorInterpretation == null) throw new IOException("Unrecognized sample dimension type"); bands[i] = new GridSampleDimension(colorInterpretation.name()); } return coverageFactory.create( rasterManager.getCoverageIdentifier(), image, new GeneralEnvelope(bbox), bands, null, null); }
final ColorModel cm = loadedImage.getColorModel(); hasAlpha |= cm.hasAlpha(); loadedImage.getSampleModel().getDataType())
throws IOException { final boolean hasPalette = image.getColorModel() instanceof IndexColorModel; final boolean hasColorModel = hasPalette ? false : image.getColorModel() instanceof ComponentColorModel; if (paletted && !hasPalette) { IndexColorModel icm = (IndexColorModel) image.getColorModel(); new ImageTypeSpecifier(image.getColorModel(), image.getSampleModel())); } else {
ColorModel firstColorModel = first.getColorModel(); SampleModel firstSampleModel = first.getSampleModel(); for (int i = 1; i < numSources; i++) { RenderedImage source = (RenderedImage) sources.get(i); SampleModel sourceSampleModel = source.getSampleModel(); ColorModel sourceColorModel = source.getColorModel(); int sourceBands = sourceSampleModel.getNumBands(); int sourceDataType = sourceSampleModel.getDataType();
.createBufferedImage(renderedImage.getWidth(), 1) .getRaster() : renderedImage.getSampleModel().getTransferType() == DataBuffer.TYPE_INT ? ImageTypeSpecifiers.createInterleaved(ColorSpace.getInstance(ColorSpace.CS_sRGB), new int[]{2, 1, 0}, DataBuffer.TYPE_BYTE, false, false) .createBufferedImage(renderedImage.getWidth(), 1) Raster raster = asByteRaster(renderedImage.getTile(tileX, tileY), renderedImage.getColorModel());
if (image.getColorModel() instanceof IndexColorModel && (image.getSampleModel().getNumBands() > 1)) { worker.retainBands(1); image = worker.getRenderedImage(); if (image.getColorModel() instanceof DirectColorModel) { worker.forceComponentColorModel(); image = worker.getRenderedImage(); if (image.getColorModel() instanceof IndexColorModel && (image.getSampleModel().getTransferType() != DataBuffer.TYPE_BYTE)) { worker.forceComponentColorModel(); image = worker.getRenderedImage(); if (image.getColorModel() instanceof ComponentColorModel) { worker.forceIndexColorModelForGIF(true); image = worker.getRenderedImage(); if (image.getColorModel() instanceof IndexColorModel) { worker.forceIndexColorModelForGIF(true); image = worker.getRenderedImage();
assert image.getColorModel() instanceof IndexColorModel; IndexColorModel cm = (IndexColorModel) image.getColorModel(); final int numComponents = cm.getNumComponents(); int transparency = cm.getTransparency(); pb.set(image.getSampleModel().getDataType(), 0); setNoData(RangeFactory.convert(nodata, image.getSampleModel().getDataType())); invalidateStatistics(); return this;
SampleModel sm = finalImage.getSampleModel(); final int sampleSize = sm.getSampleSize(0); ImageWorker iw = new ImageWorker(finalImage); finalImage = iw.getRenderedImage(); ColorModel cm = finalImage.getColorModel(); int numComponents = cm.getNumComponents(); if (!(cm instanceof ComponentColorModel) || numComponents < 3) {
final ColorModel oldCm = image.getColorModel(); if (oldCm != null) { final ColorModel newCm = newCm.createCompatibleSampleModel(image.getWidth(), image.getHeight())); } else { final int numBands = image.getSampleModel().getNumBands(); final ColorModel newCm = new ComponentColorModel(
this.numColors = numColors; this.alphaThreshold = alpaThreshold; if (image.getColorModel().hasAlpha()) { RenderedImage alpha = BandSelectDescriptor.create( image, new int[] {image.getSampleModel().getNumBands() - 1}, null); alpha = MultiplyConstDescriptor.create(alpha, new double[] {alphaThreshold}, null); image = BandSelectDescriptor.create(image, new int[] {0, 1, 2}, null);
int numBands = inputRI.getSampleModel().getNumBands(); final int tr = inputRI.getColorModel().getTransparency(); numBands = inputRI.getSampleModel().getNumBands(); assert numBands == 1;
? IHSColorSpaceJAIExt.getInstance() : IHSColorSpace.getInstance(); final int numBits = image.getColorModel().getComponentSize(0); final ColorModel ihsColorModel = new ComponentColorModel( false, Transparency.OPAQUE, image.getSampleModel().getDataType());
currentSourceCoverage .getRenderedImage() .getSampleModel() .getDataType()); layout = new ImageLayout(); if (hasAlpha && !op.getColorModel().hasAlpha()) { intermediateOps.add(op); op = w.format(op.getSampleModel().getDataType()).getRenderedImage(); final GridSampleDimension[] sd = new GridSampleDimension[op.getSampleModel().getNumBands()]; for (int i = 0; i < sd.length; i++) sd[i] = new GridSampleDimension( TypeMap.getColorInterpretation(op.getColorModel(), i).name());
if (image.getColorModel() instanceof IndexColorModel) { LookupTable lut = null; SampleModel sampleModel = image.getSampleModel(); int dataType = sampleModel.getDataType(); switch (dataType) {