TransWikia.com

Exporting raster with transparency from QGIS

Geographic Information Systems Asked by Lisa SH on December 13, 2020

As a follow on from my earlier question on reprojecting raster images – is there a way to export a reprojected PNG file (with transparency) from QGIS, with an associated world file?

I can now successfully reproject a TIF, but I’d like to keep the transparencies of the PNG.

I’d also like to have better control over the export resolution, which appears poor from using the Export > Save As > GeoTIFF option, even with ‘rendered image’ selected.

Edit: I know I could export a world file with transparency using the print composer; but I want to export the raster in a different CRS, so it needs to be a layer export option, I think!

2 Answers

Whole approach including reprojection is as follows:

Input: PNG with opacity/transparency in source CRS (Coordinate reference system)

Reprojection: Raster / Projections / Warp (reproject)

  • must use nearest neighbour method to avoid change of values
  • output as GeoTiff in target CRS (preserves opacity/transparency)

Translation: Raster / Conversion / Translate (Convert format):

  • input GeoTiff in target CRS
  • output PNG (with preserved opacity, and in target CRS)

Ideally it should be only one step but it seems gdal_warp does not support PNG format for output, hence first reprojection and then translation.

By default in QGIS 3.14 I did not get wld (pgw) file with PNG after translation, only png.aux.xml. If you require wld file, you need to do one more step:

Extract Projection: Raster / Projection / Extract Projection

  • input your final PNG
  • output is automatically wld file, optional also prj file

WLD is the same as PGW (just diferent name of extension) so if some software can read only PGW, all you have to do is copy WLD file and change extension to PGW or directly rename extension of WLD file to PGW.

Answered by Miro on December 13, 2020

With your png opened in QGIS (3.14) you could right-click on it in the legend & "Export -> Save As" a geotiff with the following suggestions (see image). If you don't like the resolution you could adjust the settings under Resolution. You'll also need to add a few "Create Opions" (yellow highlights).

enter image description here

Answered by cm1 on December 13, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP