List of utility methods to do Image
Image | getChatLogoImageBig(int width, int height) get Chat Logo Image Big return getChatLogoImage().getScaledInstance(width, height, Image.SCALE_AREA_AVERAGING);
|
Image | getColoredImage(Color color, int width, int height) Obtiene una imagen coloreada con un color especifico BufferedImage img = toBufferedImage(getEmptyImage(width, height));
Graphics2D g = img.createGraphics();
g.setColor(color);
g.fillRect(0, 0, width, height);
g.dispose();
return img;
|
Image | getDisabledImage(Image image) Replies the disabled (grayed) version of the specified image. return Toolkit.getDefaultToolkit() .createImage(new FilteredImageSource(image.getSource(), new GrayFilter(true, 20))); |
ImageIcon | getEingabeImage(int x, int y) get Eingabe Image if (Eingabe == null) { Eingabe = new ImageIcon(IMAGE_FOLDER + EINGABE_IMAGE); return prepareImage(Eingabe, x, y); |
int | getHeight(Image imagen) Obtiene el alto de una Image int height = new ImageIcon(imagen).getIconHeight(); return height; |
ImageIcon | getImageByFilename(String filename) get Image By Filename return new ImageIcon("resources/images/" + filename); |
Image | getImageImmediate(final Image image) Because of the way image loading works in Java, if one wants to IMMEDIATELY get a fully loaded image, one must resort to "hacks" by loading the image twice. image.flush(); final Image loadedImage = new ImageIcon(image).getImage(); loadedImage.flush(); return loadedImage; |
BufferedImage | GetImagenConTamanioDado(File file, int ancho, int alto) Get Imagen Con Tamanio Dado BufferedImage bi = null; if (file.exists()) { String nombreFile = file.getName(); String extension = nombreFile.substring(nombreFile.indexOf(".")); if ((extension.endsWith("jpg") || extension.endsWith("JPG")) || (extension.endsWith("png") || extension.endsWith("PNG")) || (extension.endsWith("bmp") || extension.endsWith("BMP"))) { Image img = new ImageIcon(file.getAbsolutePath()).getImage(); ... |
Image | getImageWithBorder(Image imagen) Pone borde a una imegen int w = getWidth(imagen); int h = getHeight(imagen); Graphics g = imagen.getGraphics(); g.setColor(Color.WHITE); int[] xpointsT = { 0, w, w - 1, 1 }; int[] ypointsT = { 0, 0, 1, 1 }; g.fillPolygon(xpointsT, ypointsT, 4); int[] xpointsL = { 0, 0, 1, 1 }; ... |
InputStream | getInputStreamFromImage(Image imagen, String format) Obtiene un objeto InputStream a partir de un objeto Image BufferedImage bi = toBufferedImage(imagen); ByteArrayOutputStream buffer_img = new ByteArrayOutputStream(); try { ImageIO.write(bi, format, buffer_img); } catch (Exception e) { throw new RuntimeException(e); byte[] bytes = buffer_img.toByteArray(); ... |