bufferedimage

I have extended jEditorPane to contain and display a bufferedimage from memory, but it does not paint properly. What am I doing wrong?

I have extended jEditorPane as shown below (minus the instantiation code). However, when I set the image and call update on the object, it only draws a small portion of the image (equivalent to where one line of text would go). Can somene tell me what I am doing wrong here? public class JEditorPaneImg extends JEditorPane { private Buff...

hadoop inputFile as a BufferedImage

Hi everybody; Sorry for my poor english. i hope you'll understand my problem. I have a question about hadoop developpment. I have to train myself on a simple image processing project using hadoop. All i want to do is rotate an image with Hadoop (of course i don't want hadoop use the whole image). I have a problem with the inputFormat....

How do you clone a BufferedImage

Hi I have an object which has many bufferedimages in it, I want to create a new object copying all the bufferedimages into the new object, but these new images may be altered and i dont want the original object images to be altered by altering the new objects images. is that clear? Is this possible to do and can anyone suggest a good w...

Optimize Buffered image

I'm having a buffered image with lot of small square's(grid).This image is created based on a user selected background image.If the selection is small the image appears fast.But if the selection is a large then memory overflow happen even if set to 1GB. The code for buffered image is like this: mainMap = new BufferedImage(width, height,...

java Buffered Image : Detecting black pixels

Hi everyone I have this simple code to go through a 24bit color windows bmp file BufferedImage mapa = BMPDecoder.read(new File("maps/map.bmp")); final int xmin = mapa.getMinX(); final int ymin = mapa.getMinY(); final int ymax = ymin + mapa.getHeight(); final int xmax = xmin + mapa.getWidth(); for (int i = xmin;i<xmax;i++) { for ...

ColorConvertOp is too slow

Hi again, I'm converting a TYPE_RGB BufferedImage to a TYPE_BYTE_BINARY w/ a custom IndexColorModel 4b size there's no big deal in this just a commom function, the problem that it's taking a real long time to convert. An image with dimensions 680x384 takes something like between 1~2 minutes (and NO, I'm not using a 386DX40 =P). Well I tr...

Equivalent to imshow in Clojure?

I'm looking for a way to visualize a 2d java array that's being updated in a simulation written in clojure the same way I would use imshow in matplotlib to visualize a numpy array. What's the best way to do this? Alternatively I could save the arrays to disk and visualize it in matplotlib. What would be the best way to go about that? ...

Why does a BufferedImage require so much memory beyond the size of its data array?

I'm trying to determine how much heap any given TYPE_INT_ARGB BufferedImage will use so that, for a program which is doing some image processing, I can set a reasonable max heap based on the size of image we feed it. I wrote the following program as a test, which I then used to determine the least maximum heap under which it would run w...

How to get a BufferedImage from a Component in java ?

I know how to get a BufferedImage from JComponent, but how to get a BufferedImage from a Component in java ? The emphasis here is an object of the "Component" type rather than JComponent. I tried the following method, but it return an all black image, what's wrong with it ? public static BufferedImage Get_Component_Image(Component my...

How to get a BufferedImage from a non light weight Component in java ?

I used the following method try to get a BufferedImage from a non light weight Component, but I got a black image, so it didn't work, the component I passed to it is a WebBrowser object from JDIC, it's a non light weight Component : public static BufferedImage getComponentImage(Component aComponent,Rectangle region) throws IOException...

Java Images take up too much memory.

I have a program that uses a lot of images. It loads alot of images from file, and stores them so they are only loaded once. It also creates multiple BufferedImages, about 400x400, there would be no more than 10 of these. The images from file total around 6MB. Each BufferedImage should be approx 400x400x4=640KB. Yet, the memory usage i...

Drawing Multiplie Lines in a Buffered Image in Java

Hi everyone: I am trying to draw horizontal and vertical lines on a bufferedimage. It should end up looking like a grid of cells. But when I run the code, I see only two lines: the leftmost line and the topmost line (ie. a line from 0,0 to 0,height of image & 0,0 to width of image,0) Heres the code snippet: BufferedImage mazeImage = ...

BufferedImage to BMP in Java

I have a BufferedImage object and I want to encode it to the BMP format and save it to disk. How do I do this? In Jpeg it's ok: BufferedImage img; //here is an image ready to be recorded into the hard disk FileOutputStream fout = new FileOutputStream("image.jpg"); JPEGImageEncoder jencoder = JPEGCodec.createJPEGEnco...

How to write an Image without running out of memory in Java?

final BufferedImage img = new BufferedImage(3500, 2480, BufferedImage.TYPE_BYTE_INDEXED); final Graphics2D g2D = img.createGraphics(); g2D.setBackground(Color.white); g2D.clearRect(0, 0, width, height); (full code in this question). This code results in a Java Heap Space exception although I've set the jvm attribute to 3GB. Could that...

How to create a Raster from a pixel float array in Java?

I'm trying to take a BufferedImage, apply a Fourier transform (using jtransforms), and write the data back to the BufferedImage. But I'm stuck creating a new Raster to set the results back, am I missing something here? BufferedImage bitmap; float [] bitfloat = null; bitmap = ImageIO.read(new File("filename")); FloatDCT_2D dct = new Flo...

Create an image from a non-visible AWT Component?

I'm trying to create an image (screen-shot) of a non-visible AWT component. I can't use the Robot classes' screen capture functionality because the component is not visible on the screen. Trying to use the following code: BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D g = image.createGraph...

Java writing to file misbehaving

Hello, This is yet another of my Java questions. Please take a look at this code: public static void main(String[] args) { if( args.length != 5) { System.out.println("Error. Wrong number of params!"); System.exit(0); } File file = new File(args[0]); try { BufferedImage image = ImageIO.read(file); FileWriter fstre...

Java: Best way to display multiple buffered images in a horizontal orientation(e.g. film reel)

I have a doubly linked list that's storing a bufferedimage in each node. I can easily retrieve all the buffered images by creating an iterator and iterating through list. I want to display each node horizontally one after the other in some sort of a panel. This would be similar to a film reel where frames are linked one after the other. ...