Images from Paint.NET failed inside Eclipse

196 views Asked by At

Under the following configuration:

Eclipse IDE for Java Developers - Luna Service Release 2 (4.4.2)

Java Version 8 Update 45 Build 1.8.0_45-b15

Paint.NET 4.0.5 (Final 4.5.5454.39504)

Each time i use Transparency (Alpha) PNGs inside Paint.NET, when using images on Java code inside Eclipse, i reach a Java exception:

Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Rescaling cannot be performed on an indexed image at java.awt.image.RescaleOp.filter (Unknown Source).

Anybody experienced this before? How can i solve this?

1

There are 1 answers

0
Rick Brewster On

You probably saved the PNG at 8-bit color depth without knowing it. The default bit-depth for saving a PNG in Paint.NET is "Auto", which means it will use whatever bit-depth produces the smallest file size and which results in no loss of fidelity. If your image uses less than 256 unique colors, than 8-bit will be used.

8-bit is an indexed, or "palletized," image format, hence the error about "an indexed image."

Set the bit-depth to 32 and try again :)