Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should detect a grayscale image with an alpha channel as grayscale (and related issues) #14136

Closed
qgib opened this issue Aug 10, 2011 · 10 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Rasters Related to general raster layer handling (not specific data formats)

Comments

@qgib
Copy link
Contributor

qgib commented Aug 10, 2011

Author Name: Alister Hood (@AlisterH)
Original Redmine Issue: 4159
Affected QGIS version: master
Redmine category:rasters


I used the Raster Clipper with a vector mask layer to create the attached image.
When loaded into QGIS it is invisible until I open the layer properties and specify to render as single band gray.

  1. Gdalinfo knows that band 1 is grayscale and band 2 is alpha, so I think QGIS should also be able to detect this and render as single band gray.
    -2. I would have expected rendering as three band colour to display something even if less than three bands are selected, essentially by using 255 for the missing bands. In some cases a user might want to do "two band rendering" like this. What do you think?
  2. The option to select a transparency band is always disabled (but this is already reported as Raster transparency doesn't handle alpha channel #12551)-

@qgib
Copy link
Contributor Author

qgib commented Dec 16, 2011

Author Name: Giovanni Manghi (@gioman)


  • fixed_version_id was configured as Version 1.7.4

@qgib
Copy link
Contributor Author

qgib commented Apr 16, 2012

Author Name: Paolo Cavallini (@pcav)


  • fixed_version_id was changed from Version 1.7.4 to Version 1.8.0
  • version was configured as master
  • crashes_corrupts_data was configured as 0

@qgib
Copy link
Contributor Author

qgib commented Sep 4, 2012

Author Name: Paolo Cavallini (@pcav)


  • fixed_version_id was changed from Version 1.8.0 to Version 2.0.0

@qgib
Copy link
Contributor Author

qgib commented Oct 4, 2012

Author Name: Giovanni Manghi (@gioman)


This seems to be a still valid issue with the latest qgis master.

@qgib
Copy link
Contributor Author

qgib commented Oct 10, 2012

Author Name: Alister Hood (@AlisterH)


Alister wrote:

When loaded into QGIS it is invisible until I open the layer properties and specify to render as single band gray.

I also now need to manually specify min/max values of 0 and 255 (or 254 or whatever it is). I think these should be set automatically.

Alister wrote:

  1. Gdalinfo knows that band 1 is grayscale and band 2 is alpha, so I think QGIS should also be able to detect this and render as single band gray.

Band 2 is now correctly identified as alpha on the "Transparency" tab, but not on the style tab.

@qgib
Copy link
Contributor Author

qgib commented Oct 10, 2012

Author Name: Alister Hood (@AlisterH)


Alister wrote:

  1. I would have expected rendering as three band colour to display something even if less than three bands are selected, essentially by using 255 for the missing bands. In some cases a user might want to do "two band rendering" like this. What do you think?

In master this now works as I expected.

@qgib
Copy link
Contributor Author

qgib commented Jun 28, 2014

Author Name: Jürgen Fischer (@jef-n)


  • fixed_version_id was changed from Version 2.0.0 to Future Release - Lower Priority

@qgib
Copy link
Contributor Author

qgib commented May 12, 2015

Author Name: Larry Shaffer (Larry Shaffer)


This issue appears to still be present in current master.

Also, this happens when a GeoTiff (grayscale raster with alpha) loads via WCS, like when receiving output from GeoServer. Attached is a sample file and screen snaps.

When the sample GeoTiff is loaded into QGIS, the layer had 2 bands (see screen snap):

  • Band 1 (Gray)
  • Band 2 (Alpha)

Note: when loading a similar coverage via WCS, there is not indication of Gray/Alpha band type, like QGIS recognizes when loading the GeoTiff.

Switching the render type to singleband grayscale still requires setting or loading some min/max values and stretching the contrast to those values to get the raster data to visibly render (see screen snap). The second band (alpha) is correctly recognized and auto-loaded into the Transparency layer properties panel for the GeoTiff (see screen snap).

Other than the auto-loading of the alpha band, both WCS and the GeoTiff load as multi-band color. While there doesn't seem to be any recognition of the band types for WCS, there is for the loaded GeoTiff, i.e. at least that should have its render type properly set.


  • 8696 was configured as geotiff_grayscale-w-alpha.tif
  • 8697 was configured as layer-props_band-rendering_2-bands.png
  • 8698 was configured as layer-props_band-rendering_1-band-stretch.png
  • 8699 was configured as layer-props_transp_2-band-alpha.png

@qgib
Copy link
Contributor Author

qgib commented Jun 2, 2015

Author Name: Larry Shaffer (Larry Shaffer)


I have a fix for this, and the WCS issue, in this PR: #2106

@qgib
Copy link
Contributor Author

qgib commented Jun 4, 2015

Author Name: Larry Shaffer (Larry Shaffer)


Fixed in changeset "1f74cf08de0a9190eec8349526202e6edaa9d982".


  • status_id was changed from Open to Closed

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Rasters Related to general raster layer handling (not specific data formats) labels May 24, 2019
@qgib qgib added this to the Future Release - Lower Priority milestone May 24, 2019
@qgib qgib closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Rasters Related to general raster layer handling (not specific data formats)
Projects
None yet
Development

No branches or pull requests

1 participant