Siddharth Murching created SPARK-23205:
------------------------------------------

             Summary: ImageSchema.readImages incorrectly sets alpha channel to 
255 for four-channel images
                 Key: SPARK-23205
                 URL: https://issues.apache.org/jira/browse/SPARK-23205
             Project: Spark
          Issue Type: Bug
          Components: ML, MLlib
    Affects Versions: 2.3.0
            Reporter: Siddharth Murching


When parsing raw image data in ImageSchema.decode(), we use a [java.awt.Color 
constructor|https://docs.oracle.com/javase/7/docs/api/java/awt/Color.html#Color(int)]
 that sets alpha = 255, even for four-channel images.

See the offending line here: 
https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/image/ImageSchema.scala#L172

A fix is to simply update the line to: 

val color = new Color(img.getRGB(w, h), nChannels == 4)


instead of

val color = new Color(img.getRGB(w, h))



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to