Gets an image with all recolorings of the selection colorization class.
488745
public BufferedImage getAllRecolors (boolean label)
    {
        if (_colRepo == null) {
            return null;
        }

        ColorPository.ClassRecord colClass =
            _colRepo.getClassRecord((String)_classList.getSelectedItem());
        int classId = colClass.classId;

        BufferedImage img = new BufferedImage(_image.getWidth(),
            _image.getHeight()*colClass.colors.size(), BufferedImage.TYPE_INT_ARGB);
        Graphics gfx = img.getGraphics();
        gfx.setColor(Color.BLACK);
        int y = 0;


        Integer[] sortedKeys =
            colClass.colors.keySet().toArray(new Integer[colClass.colors.size()]);
        Arrays.sort(sortedKeys);

        for (int key : sortedKeys) {
            Colorization coloriz = _colRepo.getColorization(classId, key);
            BufferedImage subImg = ImageUtil.recolorImage(
                    _image, coloriz.rootColor, coloriz.range, coloriz.offsets);

            gfx.drawImage(subImg, 0, y, null, null);

            if (label) {
                ColorRecord crec = _colRepo.getColorRecord(classId, key);
                gfx.drawString(crec.name, 2, y + gfx.getFontMetrics().getHeight() + 2);
                gfx.drawRect(0, y, _image.getWidth() - 1, _image.getHeight());
            }

            y += subImg.getHeight();
        }

        return img;
    }
875586
public Colorization getColorization (String className, int colorId)
    {
        ClassRecord crec = getClassRecord(className);
        if (crec != null) {
            ColorRecord color = crec.colors.get(colorId);
            if (color != null) {
                return color.getColorization();
            }
        }
        return null;
    }
1357249
def get(img, light=False):
    """"""
    colors = gen_colors(img)
    return adjust(colors, light)
877095
protected void convert ()
    {
        if (_image == null) {
            return;
        }

        // obtain the target color and offset
        try {
            BufferedImage image;
            if (_tabs.getSelectedIndex() == 0) {
                // All recolorings from file.
                image = getAllRecolors(_labelColors.isSelected());
                if (image == null) {
                    return;
                }
            } else if (_tabs.getSelectedIndex() == 1) {
                ArrayList<Colorization> zations = Lists.newArrayList();
                if (_classList1.getSelectedItem() != NONE) {
                    zations.add(_colRepo.getColorization((String)_classList1.getSelectedItem(),
                        (String)_colorList1.getSelectedItem()));
                }
                if (_classList2.getSelectedItem() != NONE) {
                    zations.add(_colRepo.getColorization((String)_classList2.getSelectedItem(),
                        (String)_colorList2.getSelectedItem()));
                }
                if (_classList3.getSelectedItem() != NONE) {
                    zations.add(_colRepo.getColorization((String)_classList3.getSelectedItem(),
                        (String)_colorList3.getSelectedItem()));
                }
                if (_classList4.getSelectedItem() != NONE) {
                    zations.add(_colRepo.getColorization((String)_classList4.getSelectedItem(),
                        (String)_colorList4.getSelectedItem()));
                }

                image = ImageUtil.recolorImage(_image,
                    zations.toArray(new Colorization[zations.size()]));
            } else {
                // Manual recoloring
                int color = Integer.parseInt(_source.getText(), 16);

                float hueD = _hueD.getValue();
                float satD = _saturationD.getValue();
                float valD = _valueD.getValue();
                float[] dists = new float[] { hueD, satD, valD };

                float hueO = _hueO.getValue();
                float satO = _saturationO.getValue();
                float valO = _valueO.getValue();
                float[] offsets = new float[] { hueO, satO, valO };

                image = ImageUtil.recolorImage(_image, new Color(color), dists, offsets);
            }
            _newImage.setIcon(new ImageIcon(image));
            _status.setText("Recolored image.");
            repaint();

        } catch (NumberFormatException nfe) {
            _status.setText("Invalid value: " + nfe.getMessage());
        }
    }
393557
final protected function _getColorAt($resource,$x,$y){
		$color=imagecolorat($resource,(int)$x,(int)$y);
		if($color===false){
			throw new Exception("Cannot get color");
		}
		if(imagecolorstotal($resource)){
			$rgba=imagecolorsforindex($resource,$color);
			if(!is_array($rgba)){
				throw new Exception("Cannot get colors for specified index");
			}
			return array($rgba['red'],$rgba['green'],$rgba['blue'],$rgba['alpha']);
		}
		else{
			return array(
				($color>>16)&0xFF,
				($color>>8)&0xFF,
				$color&0xFF,
				($color&0x7F000000)>>24
			);
		}
	}
29121
public function getRGBColor()
    {
        return new self(
                $this->getRed()
                , $this->getGreen()
                , $this->getBlue()
                , $this->getAlpha()
        );
    }
1213997
public static BufferedImage invertImageColor(BufferedImage image) {
        BufferedImage tmp = new BufferedImage(image.getWidth(), image.getHeight(), image.getType());
        BufferedImageOp invertOp = new LookupOp(new ShortLookupTable(0, invertTable), null);
        return invertOp.filter(image, tmp);
    }
1140748
def get_colors(image):
    
    colors = Counter(pixel for row in image for pixel in row)
    if len(colors) > 256:
        msg = (
            "The maximum number of distinct colors in a GIF is 256 but "
            "this image has {} colors and can't be encoded properly."
        )
        raise RuntimeError(msg.format(len(colors)))
    return colors
250110
def get_colors(img):
    
    w, h = img.size
    return [color[:3] for count, color in img.convert('RGB').getcolors(w * h)]
198651
def get_color_mode(mode):
    """"""
    name = mode.upper()
    name = name.rstrip('A')  # Trim alpha.
    name = {'1': 'BITMAP', 'L': 'GRAYSCALE'}.get(name, name)
    return getattr(ColorMode, name)
597817
def get_wxcolour(self, color):
        """"""
        DEBUG_MSG("get_wx_color()", 1, self)
        if len(color) == 3:
            r, g, b = color
            r *= 255
            g *= 255
            b *= 255
            return wx.Colour(red=int(r), green=int(g), blue=int(b))
        else:
            r, g, b, a = color
            r *= 255
            g *= 255
            b *= 255
            a *= 255
            return wx.Colour(red=int(r), green=int(g), blue=int(b), alpha=int(a))
904754
def _svgcolor(color):
    
    return 'rgb(%d,%d,%d)' % tuple([int(255 * x) for x in [color.r, color.g, color.b]])
1174985
protected function convertToTrueColor()
    {
        if (!imageistruecolor($this->resource)) {
            if (function_exists('imagepalettetotruecolor')) {
                // Available in PHP 5.5
                imagepalettetotruecolor($this->resource);
            } else {
                $transparentIndex = imagecolortransparent($this->resource);

                $w = $this->width();
                $h = $this->height();

                $img = imagecreatetruecolor($w, $h);
                imagecopy($img, $this->resource, 0, 0, 0, 0, $w, $h);

                if ($transparentIndex != -1) {
                    $width = $this->width();
                    $height = $this->height();

                    imagealphablending($img, false);
                    imagesavealpha($img, true);

                    for ($x = 0; $x < $width; ++$x) {
                        for ($y = 0; $y < $height; ++$y) {
                            if (imagecolorat($this->resource, $x, $y) == $transparentIndex) {
                                imagesetpixel($img, $x, $y, 127 << 24);
                            }
                        }
                    }
                }

                $this->resource = $img;
            }
        }

        imagesavealpha($this->resource, true);
    }
701159
public static StateListDrawable getSelectableImageButtonBackground(int selected_color) {
		ColorDrawable selectedColor = new ColorDrawable(selected_color);
		StateListDrawable states = new StateListDrawable();
		states.addState(new int[]{android.R.attr.state_pressed}, selectedColor);
		states.addState(new int[]{android.R.attr.state_activated}, selectedColor);
		return states;
	}
209607
def get(img, light=False):
    """"""
    cols = gen_colors(img)

    if len(cols) < 6:
        logging.error("colorz failed to generate enough colors.")
        logging.error("Try another backend or another image. (wal --backend)")
        sys.exit(1)

    return adjust(cols, light)
158202
def get(img, light=False):
    """"""
    cols = gen_colors(img)
    return adjust(cols, light)
397302
public static BufferedImage toImage(BitMatrix matrix, int foreColor, int backColor) {
		final int width = matrix.getWidth();
		final int height = matrix.getHeight();
		BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
		for (int x = 0; x < width; x++) {
			for (int y = 0; y < height; y++) {
				image.setRGB(x, y, matrix.get(x, y) ? foreColor : backColor);
			}
		}
		return image;
	}