Bug report #7748

Transparent pixel list doesn't work if global transparency 0

Added by Roland Hill over 11 years ago. Updated over 11 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:-
Category:Rasters
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:16651

Description

The Transparent pixel list has no effect if the Global Transparency slider is set to 0. If you set the global transparency > 0 (eg 1%) then suddenly the Transparent Pixel List works as expected.

To test, load a raster with some large areas of consistent colour (eg white or black borders). Use the Add Values From Display button to make a colour transparent then click Apply. Nothing happens. Bump the Global Transparency to 1% and click Apply - the selected colour is now transparent.

Using version 1.9.0-Master from today 2/5/2013.

Thanks,

Roland

Test.7z (11.8 KB) Roland Hill, 2013-05-02 03:57 PM

Associated revisions

Revision 83ffa053
Added by Radim Blazek over 11 years ago

raster 3 band taransparency, fixes #7748, thanks to Mathieu Pellerin

History

#1 Updated by Giovanni Manghi over 11 years ago

  • Status changed from Open to Feedback

can you attach sample data? it works ok here with my data.

#2 Updated by Roland Hill over 11 years ago

Example data is attached. The image has invalid areas set to black. I can't make them transparent without global transparency > 0.

Thanks for taking a look.

Roland

#3 Updated by Giovanni Manghi over 11 years ago

  • Target version set to Version 2.0.0
  • Priority changed from Normal to Severe/Regression

ok, it happens if the raster is RGB, see also #7756

#4 Updated by Mathieu Pellerin - nIRV over 11 years ago

#7756 mentions that, at least with RGB 3-band rasters, choosing a non "no enhancement" color enhancement mode will also make the transparent pixel values work as expected.

Also, a 3-band LANDSAT-7 true color geotiff for testing: http://licadho-cambodia.org/raster/321.zip (64mb)

#5 Updated by Holger Eberhardt over 11 years ago

I can confirm this bug.
Example graphics can be downloaded here (Transparency_Bug.7z 34 MB).
In my case it's a png-File (RGB 16,7 million colours) with an external pyramids file (ERDAS). I want to hide the yellow (255,255,0) borders via custom transparency settings. But it only works when global transparency is set at least to 1%.

#6 Updated by Mathieu Pellerin - nIRV over 11 years ago

I've looked at the transparency values issue and believe the issue is with the bool fastDraw check (qgsmultibandcolorrenderer.cpp line 136), which seems to fail in checking for transparency list items. I unfortunately am not familiar with this code, nor the usesTransparency() function fastDraw relies on. Hope this can help you figure out what is wrong.

#7 Updated by Mathieu Pellerin - nIRV over 11 years ago

Ok, I think I got it.

usesTransparency (function defined qgsrasterrenderer.cpp line 86) checks whether there's a transparency value list via this bit of code: !mRasterTransparency->isEmpty()

isEmpty() (function defined qgsrastertransparency.cpp line 180) only checks for mTransparentSingleValuePixelList count, not mTransparentThreeValuePixelList. So transparency list defined for three value pixel will always return false. This means it fails to disable fastDraw unless some other raster modification is applied (global opacity, contrast, etc.)

Voila :)

#8 Updated by Radim Blazek over 11 years ago

  • Status changed from Feedback to Closed

#9 Updated by Mathieu Pellerin - nIRV over 11 years ago

Verified as fixed, thanks Radim.

Also available in: Atom PDF