Solved

Image quality reduction

Posted on 1997-03-13
2
211 Views
Last Modified: 2012-06-27
I have emade a couple of applets showing a slideshow with images.
When the images (gif or jpg) appear in the applet, the quality is
reduced from the original image. It seem like they show up in 16 colors
or non-dithered or something.
I have tried different images, but the problem appear each time.
Doesnt java support a 256 color dithered gif ??

0
Comment
Question by:apriks
2 Comments
 

Accepted Solution

by:
amarshal earned 50 total points
ID: 1219004
When a true color (16-Million) display is not available, the majority of Java platforms convert the image into Web colors, a 256-color pallete agreed upon by all browsers.

The best answer I have to fix this problem is to convert the images to Web colors, as a gif, before you upload them.  Photoshop does an excellent job of converting the images, and 4.0 has an option under mode-indexed color to choose web colors directly.  It will look a little bit dithered by being in 256 color mode, but Photoshop's algorithm is much better.
0
 
LVL 2

Expert Comment

by:mgk
ID: 1219005
You can fix the dithering problem with Netscape by creating the image again from a memory source.

Check out http://www.powerup.com.au/~mgk/java/banner.html, if you view source you will see that most of the banners are full colour GIFs. In this case I ran it all through a Filter that did nothing to the image data, but you could also convert all the data into an array and then create an image with it. Images created from memory don't dither. Here's the code:

Image tempimage=getImage(getCodeBase(),getParameter("banner"+i));
ImageFilter f=new FixDither();
ImageProducer producer=new FilteredImageSource(tempimage.getSource(),f);
image=this.createImage(producer);


class FixDither extends RGBImageFilter {
  public void FixDither() {
    canFilterIndexColorModel = true;
  }
      
  public int filterRGB(int x, int y, int rgb) {
    return rgb;
  }
}
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question