When I read certain JPG files, colors are flattened. Here is a simple example that reads a jpg and just writes the same image to another file.
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
public class JPegReadTest {
public static void main(String[] args) {
if (args.length == 2) {
try {
BufferedImage src = ImageIO.read(new File(args[0]));
ImageIO.write(src, "jpg", new File(args[1]));
} catch (Exception e) {
e.printStackTrace();
}
} else {
System.err.println("Usage: java JPegReadTest src dest");
}
}
}
If you try this with for example http://www.flickr.com/photos/visualpanic/233508614/sizes/l/ , the colors of the destination image differ from the source file. Why is that? How to fix it?
Also tried saving the image as png, but the colors are bland in it too (so assuming color info is not read properly).