Image output quality
hope here is the right place for this thread, hopefully its a pretty simple question,
basically I have a 1-d array of 2000*1500 integers, each representing a pixel of the image I want to write, and first used:
to write the data to the image, but the quality is pretty bad, definitely a lot worse than is should be for an image that big, and the quality looks the same for any image format.
data][ = getData();
image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
image.setRGB(0, 0, width, height, data, 0, width);
File outFile = new File("/home/linus/Documents/julia1.jpg");
ImageIO.write( image , "jpg", outFile );
After some searching I managed to use an image writer and change the quality parameter from 0.9f to 1.0f but this doesn't make a great deal of difference, I really just need to output the exact pixels specified in the array to an image, it seems somewhere the image is being messed about with, presumably when I make the BufferedImage.
(attatchment is same scale and quality as actual output)
If anyone can suggest a different approach or direct me to some good information about this, would be a big help!
edit: probably should add, the methods for producing the data aren't the problem, zooming in on any of the smaller "blobs" gives much higher quality.
I don't know the answer to your question, but I do recognize that image from somewhere,.... but where? ;)
its a bit of the mandelbrot set...would be very pretty if it wasn't so pixellated
I was joking of course. Please see my forum "image". I am a fan of fractal geometry including Mandelbrot and Julia sets.
Originally Posted by linus_k
ah lol didn't notice that, looks like it was made with flam3??
yeah me too...currently working on algorithms for drawing julia sets/ hubbard trees but I'm not at all used to java
> I really just need to output the exact pixels specified in the array to an image
Provided the quality of the BufferedImage (prior to saving) is adequate, you need to save to a lossless file format like PNG (or BMP -- I don't know whether ImageIO supports BMP). The loss of quality is due to JPEG artefacts.
thanks darryl, will give it a try
Image output quality
BMP files are supported, but they are HUGE.
I think the issue is that JPEG files will provide varying amounts of data compression, and it is possible to create a JPEG file without data compression, so that you will get a "perfect" image (like a BMP), but a lot smaller than a BMP, because the data is stored more efficiently (like specifying that the data repeats over a sequence of pixels, rather than specifying each individual pixel, which is done in a BMP file).
So the question is, how do you get more control over how a JPEG file is created? How do you specify the desired data compression?
Sorry, I misread the first entry, and I see that the quality parameter is discussed. I got it figured out now. -Scott