< prev index next >

src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriterSpi.java

Print this page

        

@@ -71,11 +71,15 @@
         return false;
     }
 
     public boolean canEncodeImage(ImageTypeSpecifier type) {
         SampleModel sampleModel = type.getSampleModel();
+        ColorModel cm = type.getColorModel();
 
+        if (cm.hasAlpha()) {
+            return false;
+        }
         // Find the maximum bit depth across all channels
         int[] sampleSize = sampleModel.getSampleSize();
         int bitDepth = sampleSize[0];
         for (int i = 1; i < sampleSize.length; i++) {
             if (sampleSize[i] > bitDepth) {
< prev index next >