Bug report #4953

Transparency band not persisted in QgsProject

Added by Tim Sutton almost 8 years ago. Updated about 7 years ago.

Status:Closed
Priority:Normal
Assignee:Tim Sutton
Category:Rasters
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed
Crashes QGIS or corrupts data:No Copied to github as #:14749

Description

When using a single band raster and setting the tranparency band to band 1, the transparency is correctly applied. However when closing and then reopening the project, the layer transparency band reverts to 'Not Set'.

Expected behaviour:

The transparency band state should be properly restored to band 1 when the project is opened.

History

#1 Updated by Paolo Cavallini over 7 years ago

  • Target version changed from Version 1.7.4 to Version 1.8.0

#2 Updated by Paolo Cavallini about 7 years ago

  • Target version changed from Version 1.8.0 to Version 2.0.0

#3 Updated by Homme Zwaagstra about 7 years ago

This is an issue for me in QGIS 1.8.0. Whichever band is selected as the transparency band it is not persisted in the `.qgs` project file. The following is the map layer corresponding to a grayscale TIF whose alpha band I am trying to set as the transparent band:

<maplayer minimumScale="0" maximumScale="1e+08" type="raster" hasScaleBasedVisibilityFlag="0">
    <id>hillshade20121025100031179</id>
    <datasource>./hillshade.tif</datasource>
    <title></title>
    <abstract></abstract>
    <layername>hillshade</layername>
    <srs>
        <spatialrefsys>
            <proj4>+proj=longlat +datum=WGS84 +no_defs</proj4>
            <srsid>3452</srsid>
            <srid>4326</srid>
            <authid>EPSG:4326</authid>
            <description>WGS 84</description>
            <projectionacronym>longlat</projectionacronym>
            <ellipsoidacronym>WGS84</ellipsoidacronym>
            <geographicflag>true</geographicflag>
        </spatialrefsys>
    </srs>
    <transparencyLevelInt>62</transparencyLevelInt>
    <customproperties/>
    <provider>gdal</provider>
    <rasterproperties>
        <mDrawingStyle>MultiBandSingleBandGray</mDrawingStyle>
        <mColorShadingAlgorithm>UndefinedShader</mColorShadingAlgorithm>
        <mInvertColor boolean="false"/>
        <mRedBandName>Band 1</mRedBandName>
        <mGreenBandName>Band 2</mGreenBandName>
        <mBlueBandName>Band 2</mBlueBandName>
        <mGrayBandName>Band 1</mGrayBandName>
        <mStandardDeviations>0</mStandardDeviations>
        <mUserDefinedRGBMinimumMaximum boolean="false"/>
        <mRGBMinimumMaximumEstimated boolean="true"/>
        <mUserDefinedGrayMinimumMaximum boolean="false"/>
        <mGrayMinimumMaximumEstimated boolean="true"/>
        <mContrastEnhancementAlgorithm>NoEnhancement</mContrastEnhancementAlgorithm>
        <contrastEnhancementMinMaxValues>
            <minMaxEntry>
                <min>0</min>
                <max>255</max>
            </minMaxEntry>
            <minMaxEntry>
                <min>0</min>
                <max>255</max>
            </minMaxEntry>
        </contrastEnhancementMinMaxValues>
        <mNoDataValue mValidNoDataValue="true">-32768.000000</mNoDataValue>
        <singleValuePixelList>
            <pixelListEntry pixelValue="-32768.000000" percentTransparent="100"/>
        </singleValuePixelList>
        <threeValuePixelList>
            <pixelListEntry red="-32768.000000" blue="-32768.000000" green="-32768.000000" percentTransparent="100"/>
        </threeValuePixelList>
    </rasterproperties>
</maplayer>

#4 Updated by Giovanni Manghi about 7 years ago

  • Status changed from Open to Feedback
  • Operating System deleted (all)

Homme Zwaagstra wrote:

This is an issue for me in QGIS 1.8.0. Whichever band is selected as the transparency band it is not persisted in the `.qgs` project file. The following is the map layer corresponding to a grayscale TIF whose alpha band I am trying to set as the transparent band:

[...]

have you tested qgis master? many things changed in rasters in qgis master... please try and leave feedback.

#5 Updated by Homme Zwaagstra about 7 years ago

Giovanni Manghi wrote:

have you tested qgis master? many things changed in rasters in qgis master... please try and leave feedback.

I have tested in qgis master against commit a27aad04f6583630c729d078ce01e3000b16eabe (1.9.0 Alpha) and it seems to have fixed the issue - thanks!

#6 Updated by Giovanni Manghi about 7 years ago

  • Resolution set to fixed
  • Status changed from Feedback to Closed

Also available in: Atom PDF