Java Utililty Methods Image

List of utility methods to do Image

Description

The list of methods to do Image are organized into topic(s).

Method

booleanisContinueImageUpdate(JComponent comp, Image img)
is Continue Image Update
return false;
ImageloadImage(byte[] imgStr, int imageSize)
load Image
ImageIcon imgIcon = new ImageIcon(imgStr);
if (imgIcon == null)
    return null;
return getScaledImage(imgIcon.getImage(), imageSize);
BufferedImagemakeColorTransparent(Image im, Color c)
Make a color in the image transparent
int[] redRange = { 0, 0 };
int[] greenRange = { 0, 0 };
int[] blueRange = { 0, 0 };
if (c != null) {
    redRange[0] = redRange[1] = c.getRed();
    greenRange[0] = greenRange[1] = c.getGreen();
    blueRange[0] = blueRange[1] = c.getBlue();
return makeColorTransparent(im, redRange, greenRange, blueRange);
Imagemask(Image img, Color color)
Pone color en una imagen transparente.
BufferedImage bimg = toBufferedImage(getEmptyImage(img.getWidth(null), img.getHeight(null)));
Graphics2D g = bimg.createGraphics();
g.drawImage(img, 0, 0, null);
g.dispose();
for (int y = 0; y < bimg.getHeight(); y++) {
    for (int x = 0; x < bimg.getWidth(); x++) {
        int col = bimg.getRGB(x, y);
        if (col == color.getRGB()) {
...
BufferedImageopenImage()
open Image
BufferedImage image = null;
File file;
JFileChooser fC = new JFileChooser(new File("."));
if (JFileChooser.APPROVE_OPTION == fC.showOpenDialog(null)) {
    file = fC.getSelectedFile();
    try {
        image = ImageIO.read(file);
    } catch (IOException e) {
...
JFileChooseropenImageFileChooser(Component com)
File chooser images.
final JFileChooser fileChooser = new JFileChooser();
fileChooser.removeChoosableFileFilter(fileChooser.getAcceptAllFileFilter());
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("PDF Documents (*.pdf)", "pdf"));
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("Encapsulated PostScript (*.eps)", "eps"));
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("PostScript (*.ps)", "ps"));
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("Scalable Vector Graphics (*.svg)", "svg"));
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("Compressed SVG  (*.svgz)", "svgz"));
...
BufferedImagepaintToImage(Component comp)
paint To Image
int width = comp.getWidth();
int height = comp.getHeight();
if (width <= 0 || height <= 0) {
    return null;
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = image.createGraphics();
RepaintManager manager = RepaintManager.currentManager(comp);
...
StringprepareImagePath(String html, URL url)
prepare Image Path
final Set<String> list = new TreeSet<String>();
final ParserDelegator parserDelegator = new ParserDelegator();
final HTMLEditorKit.ParserCallback parserCallback = new HTMLEditorKit.ParserCallback() {
    @Override
    public void handleText(final char[] data, final int pos) {
    @Override
    public void handleStartTag(HTML.Tag tag, MutableAttributeSet attribute, int pos) {
...
voidremoveImage(JLabel image)
remove Image
image.setVisible(false);
window.remove(image);
BufferedImageremoveRedeye(Image im, final int x1, final int y1, final int x2, final int y2)
Remove the brighter red from the image
ImageFilter filter = new RGBImageFilter() {
    public final int filterRGB(int x, int y, int rgb) {
        if ((x < x1) || (x > x2) || (y < y1) || (y > y2)) {
            return rgb;
        int threshold = 0;
        int r = (rgb >> 16) & 0xff;
        int g = (rgb >> 8) & 0xff;
...