You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Sean Owen (JIRA)" <ji...@apache.org> on 2018/01/26 00:17:00 UTC

[jira] [Resolved] (SPARK-23205) ImageSchema.readImages incorrectly sets alpha channel to 255 for four-channel images

     [ https://issues.apache.org/jira/browse/SPARK-23205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sean Owen resolved SPARK-23205.
-------------------------------
       Resolution: Fixed
    Fix Version/s: 2.3.0

Issue resolved by pull request 20389
[https://github.com/apache/spark/pull/20389]

> 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
>            Assignee: Siddharth Murching
>            Priority: Critical
>             Fix For: 2.3.0
>
>
> 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