Results 1 to 9 of 9
  1. #1
    linus_k is offline Member
    Join Date
    Nov 2008
    Posts
    5
    Rep Power
    0

    Default Image output quality

    Hi all,
    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:

    Java Code:
            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 );
    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.

    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!

    Thanks,
    Chris

    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.
    Attached Thumbnails Attached Thumbnails Image output quality-mand2.jpg  
    Last edited by linus_k; 01-24-2009 at 09:08 PM.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    I don't know the answer to your question, but I do recognize that image from somewhere,.... but where? ;)

  3. #3
    linus_k is offline Member
    Join Date
    Nov 2008
    Posts
    5
    Rep Power
    0

    Default

    its a bit of the mandelbrot set...would be very pretty if it wasn't so pixellated

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Quote Originally Posted by linus_k View Post
    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.

  5. #5
    linus_k is offline Member
    Join Date
    Nov 2008
    Posts
    5
    Rep Power
    0

    Default

    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

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default

    > 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.

    db

  7. #7
    linus_k is offline Member
    Join Date
    Nov 2008
    Posts
    5
    Rep Power
    0

    Default

    thanks darryl, will give it a try

  8. #8
    ScottVal is offline Member
    Join Date
    Jan 2009
    Posts
    35
    Rep Power
    0

    Default 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?

    -scott

  9. #9
    ScottVal is offline Member
    Join Date
    Jan 2009
    Posts
    35
    Rep Power
    0

    Default

    Sorry, I misread the first entry, and I see that the quality parameter is discussed. I got it figured out now. -Scott

Similar Threads

  1. How to draw 2 images with quality?
    By Panchitopro in forum Java 2D
    Replies: 1
    Last Post: 03-12-2009, 08:31 AM
  2. Canvas Image popups another image (SWT)
    By SpaceY in forum New To Java
    Replies: 2
    Last Post: 11-11-2008, 01:25 PM
  3. drawing an image to an offscreen image
    By hunterbdb in forum Java 2D
    Replies: 9
    Last Post: 10-30-2008, 06:17 PM
  4. Why the output is always zero
    By mehrotra.chitij in forum New To Java
    Replies: 12
    Last Post: 04-25-2008, 04:05 AM
  5. Replies: 0
    Last Post: 01-08-2008, 05:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •