You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Siddharth Murching (JIRA)" <ji...@apache.org> on 2018/01/24 22:22:00 UTC
[jira] [Created] (SPARK-23205) ImageSchema.readImages incorrectly
sets alpha channel to 255 for four-channel images
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-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org