Solved

Image quality reduction

Posted on 1997-03-13
2
210 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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now