I'm working on some code to colorize an image in Java. Basically what I'd like to do is something along the lines of GIMP's colorize command, so that if I have a BufferedImage and a Color, I can colorize the Image with the given color. Anyone got any ideas? My current best guess at doing something like this is to get the rgb value of eac...
When I read a JPEG from disk, Java sometimes gives me a BufferedImage whose getType() returns TYPE_CUSTOM -- that is, it has a custom color model. I'd like to resize this BufferedImage but I'm not sure how to construct the destination object. Can someone please provide sample code for using the following constructor?
BufferedImage(Color...
I have some image constrain code that allows you to output to a MemoryCacheImageOutputStream, but I need to get this back into a BufferedImage, any suggestions?
...
Okay, so I've been trying to load a BufferedImage using this code:
URL url = this.getClass().getResource("test.png");
BufferedImage img = (BufferedImage) Toolkit.getDefaultToolkit().getImage(url);
This gives me a type cast error when I run it though, so how do I properly load a BufferedImage?
...
I have a servlet based application that is serving images from files stored locally. I have added logic that will allow the application to load the image file to a BufferedImage and then resize the image, add watermark text over the top of the image, or both.
I would like to set the content length before writing out the image. Apart f...
How do I change the global alpha value of a BufferedImage in Java? (I.E. make every pixel in the image that has a alpha value of 100 have a alpha value of 80)
...
Hi,
I have the following problem. I have C code that acquires a PNG image as basically raw data and keeps it in memory. I would like this raw data to be translated to a BufferedImage in Java, through the use of JNI. Does anyone know any way of doing this or has done this before?
...
I'm using JNI to obtain raw image data in the following format:
The image data is returned in the format of a DATA32 (32 bits) per pixel in a linear array ordered from the top left of the image to the bottom right going from left to right each line. Each pixel has the upper 8 bits as the alpha channel and the lower 8 bits are the blue ...
I know its possible to convert an image to CS_GRAY using
public static BufferedImage getGrayBufferedImage(BufferedImage image) {
BufferedImageOp op = new ColorConvertOp(ColorSpace
.getInstance(ColorSpace.CS_GRAY), null);
BufferedImage sourceImgGray = op.filter(image, null);
return sourceImgGray;
}
however, this is a chokepoint...
I'm attempting to create a very large image in Java like so:
BufferedImage bi = new BufferedImage(58240, 1664, BufferedImage.TYPE_INT_RGB);
obviously the image is very large.
Now the issue I'm having is that it seems to work fine 100% on some computers but really slowly on others (and no this has NOTHING to do with specs).
My most m...
Is there a simple way of rendering to a BufferedImage in Java3D?
I know you can extend Canvas3D, but it seems cumbersome if I just want to render directly.
...
I've been trying to make off screen rendering to work, using Java3D 1.5.2. In my source code I've been trying to attach an extended Canvas3D that will do off-screen rendering to SimpleUniverse, but doing so will break the render:
62. // FOR SOME REASON THIS BREAKS RENDERING
63. universe.getViewer().getView().addCanvas3D(canvas);
The...
I need to create a rectangular BufferedImage with specified color as a background, draw some pattern on the background and save it to file. My problem comes from how to create the background,I am using nexted loop:
BufferedImage b_img = ...
for every row
for every column
setRGB(r,g,b);
But it's very slow when the image is large.
How ...
Hello, I am looking for a small and free TGA image loading class or library for java.
Ideally the result is a BufferedImage.
Yes, I have already googled, but most results are outdated, or are quite big libraries that contain a lot of other stuff i dont need. I am looking for something small and simple that reads just TGA images.
Thanks...
Given an Applet object, is it possible to programatically obtain a "screen shot" of the applet window (represented as say a BufferedImage)?
JApplet applet = this;
// ... code here ...
BufferedImage screenshotOfApplet = ...;
...
Error: Unhandled exception type IOException.
File imgLoc = new File("player.png");
BufferedImage img = ImageIO.read(imgLoc);
How do I get a bufferedImage from a file location?
...
Hi,
I am reading pixel color in a BufferedImage as follows:
.....
InputStream is = new BufferedInputStream(conn.getInputStream());
BufferedImage image = ImageIO.read(is);
int color = image.getGRB(x, y);
int red = (colour & 0x00ff0000) >> 16;
int green = (colour & 0x0000ff00) >> 8;
int blue = colour & 0x000000ff;
Now this works f...
Hello,
I am trying to load an image file (gif) which is stored locally in the same directory as my Eclipse java project:
ref is the relative path where the gif image is stored.
public Sprite getSprite(String ref) {
BufferedImage sourceImage = null;
try {
URL url = this.getClass().getClassLoader().getResource(ref); ...
Given an Image object, how do I turn that into a BufferedImage object without using any of the graphics stuff?
Thanks.
(P.S. I'm using Java ImageIO library)
...
I have a BufferedImage of type TYPE_INT_BGR. I need to do a pixel-by-pixel comparison to another BufferedImage to compute the "distance" between the two images. I have something that works, but is slow. I get a pixel from the "reference" image, break it up into RGB bytes with:
int pixel = referenceImage.getRGB(col, row);
int ...