2

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!

0

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.

| improve this answer | |
0

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

| improve this answer | |
  • This is great for exporting TIF, but from my understanding of question, the goal is to get PNG with transparency. And unfortunately in QGIS 3.14 I do not see PNG in export formats list. – Miro Sep 15 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.