2

The raster I have is 1m LiDAR data that's been patched and properly color corrected. The resolution of it should already be 1m/pixel.

The coordinate system is properly set, the measure tool measures accurate distances in meters.

When exporting an image, I get odd results and bad pixel sizes when selecting a scale of 1:1.

Either I do not understand how this scale option works, or I'm doing this incorrectly.

I need an output file that matches the extent of the selected area with a ratio of 1m per pixel. DPI should not matter.

Furthermore, if possible, the output should be a PNG @ 16 bit. I'd settle for any sort of uncompressed image where the ratio is correct and each pixel is a meter.

3 Answers 3

4

I think dpi matters. I presume you did the export via Project > Import/Export > Export Map to Image...

enter image description here

wherein you can set the resolution (in dpi):

enter image description here

calculating the dpi theoretically necessary:

x * px/inch = px/m

x = (px/m) / (px/inch)

x = inch/m = 2.54cm / 100cm = 0.0254

So you would have to set the resolution to 0.0254 dpi.

Unfortunately at least in this export tool float values for the resolution are allways rounded to integers, which implies that you cannot set resolutions less than 1.

2
  • Ah, the question makes more sense now, cheers! I've always viewed "Export Map to Image" as something I'd use for publication, whereas the "Export > Save" from right-clicking the layers panel is something I'd use for when I need to ensure the integrity of the underlying data, which I think is what is needed here.
    – statto
    Jan 23, 2020 at 12:42
  • This doesn't work in practice. Setting the DPI at 1 and the Scale at 1:1 with a 1080x1080 pixel size fails the export. (nor would it provide the correct results anyway). I do not have a "save" option under Import/Export. Viable options are Export map to Image Export map to PDF Export Project to DXF Jan 27, 2020 at 4:59
1

I'm not sure where you're selecting a scale, but if you already have a resolution of 1m/pixel within QGIS, you don't need to do any further adjustments.

I have just tried exporting a test raster in QGIS. I right-clicked on the raster layer in the layers panel, selected Export > Save As, selected the "Columns" feature, and everything exported properly. The "Columns" function should be fine for you as your resolution's already set, as "columns" sets the resolution in pixels of your output. If the values under "Column" match the resolution of the pixels in your raster file, you should be good to go when you export.

May be wrong on this but from my test it doesn't look like you can save to a PNG directly from QGIS, but a quick search shows there are many ways of converting a GeoTIFF to a PNG, including using image processing software such as GIMP and converting.

5
  • Thanks for pointing me there, Turns out the initial mages are not the correct scale. What is the best way to translate the map to the proper 1:1 pixel to meter scale I need? Jan 27, 2020 at 5:01
  • Are you able to determine what the current scale is? Also, if you know your underlying file uses a 1-meter grid but isn't displaying properly in QGIS, you should still be able to export the data to GeoTIFF using the columns feature and then strip away. Otherwise you'll likely have to orthorectify the file.
    – statto
    Jan 27, 2020 at 6:40
  • I can see the overall pixel size is somewhere around 14,000 (instead of 38,000). I was thinking I would need to translate or (can't recall the other function's name, warp?) The images. I'm just not sure how I can get a pixel size into it... Jan 27, 2020 at 16:28
  • Did you create the raster in QGIS or import it? What is your base file format?
    – statto
    Jan 28, 2020 at 13:19
  • The base file format is a set of .hgt tiles. I adjusted those tiles and fixed the coloring and ended up with a geotiff raster. Jan 29, 2020 at 15:21
1

It has been some time since the post, but I came across a similar problem (I needed to convert a geotiff file into a 16 bit png file for Machine Learning research).

The solution for me was as follows:

  • On QGIS > First, set the right channels and histogram in Properties, then > Export > Save As > Select 'Rendered Image' > File Format as GeoTIFF > OK

  • Open exported GeoTIFF on ImageJ (Fiji) > File > Save As > Select PNG

Once you open the image on ImageJ, you can also create segmentation masks, adjust histogram and change espectral resolution, amongst other tweaks.

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.