1

I am using

gdal_translate -of PNG -ot UInt16 -scale MIN MAX 0 65535 "source.tiff" "output.png"

in the command-prompt to create a .png-file from a .tif-file that I created using the Interpolation-plugin. But when i view the png-file in Windows photo, it has the wrong dimensions, it gets really distorted(squished) in the y-axis, and less noticeably distorted in the x-axis. But if I drag the .png to QGIS it isn't distorted anymore.

This is the output of gdalinfo for the .tif:

Size is 3000, 3000 Coordinate System is: PROJCS["unnamed", GEOGCS["unnamed ellipse", DATUM["unknown", SPHEROID["unnamed",6378137,298.257222101], EXTENSION["PROJ4_GRIDS","@null"]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433]], PROJECTION["Transverse_Mercator"], PARAMETER["latitude_of_origin",0], PARAMETER["central_meridian",15], PARAMETER["scale_factor",0.9996], PARAMETER["false_easting",500000], PARAMETER["false_northing",0], UNIT["Meter",1]] Origin = (-142.699000000000012,251.647000000000048) Pixel Size = (0.068380000000000,-0.119760000000000) Corner Coordinates: Upper Left ( -142.699, 251.647) ( 10d30'35.92"E, 0d 0' 8.17"N) Lower Left ( -142.699, -107.633) ( 10d30'35.92"E, 0d 0' 3.49"S) Upper Right ( 62.441, 251.647) ( 10d30'42.54"E, 0d 0' 8.17"N) Lower Right ( 62.441, -107.633) ( 10d30'42.54"E, 0d 0' 3.49"S) Center ( -40.1290000, 72.0070000) ( 10d30'39.23"E, 0d 0' 2.34"N) Band 1 Block=3000x1 Type=Float32, ColorInterp=Undefined NoData Value=-9999

And for the .png:

Size is 3000, 3000 Coordinate System is: PROJCS["unnamed", GEOGCS["unnamed ellipse", DATUM["unknown", SPHEROID["unnamed",6378137,298.257222101], EXTENSION["PROJ4_GRIDS","@null"]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433]], PROJECTION["Transverse_Mercator"], PARAMETER["latitude_of_origin",0], PARAMETER["central_meridian",15], PARAMETER["scale_factor",0.9996], PARAMETER["false_easting",500000], PARAMETER["false_northing",0], UNIT["Meter",1]] Origin = (-142.699000000000012,251.647000000000048) Pixel Size = (0.068380000000000,-0.119760000000000) Corner Coordinates: Upper Left ( -142.699, 251.647) ( 10d30'35.92"E, 0d 0' 8.17"N) Lower Left ( -142.699, -107.633) ( 10d30'35.92"E, 0d 0' 3.49"S) Upper Right ( 62.441, 251.647) ( 10d30'42.54"E, 0d 0' 8.17"N) Lower Right ( 62.441, -107.633) ( 10d30'42.54"E, 0d 0' 3.49"S) Center ( -40.1290000, 72.0070000) ( 10d30'39.23"E, 0d 0' 2.34"N) Band 1 Block=3000x1 Type=UInt16, ColorInterp=Gray NoData Value=-9999

12
  • can you add the output of gdalinfo on both the images
    – Ian Turton
    Jun 8, 2017 at 9:23
  • did you try specifying your desired output dimensions with -outsize ?
    – Val
    Jun 8, 2017 at 9:28
  • Val, I tried with -outsize 100% 100% but it did nothing. @iant How do I add images in comments?
    – Gisnoob123
    Jun 8, 2017 at 9:33
  • Not in percent, rather in pixels. It would be interesting to see the output of gdalinfo for your source tiff as @iant requested
    – Val
    Jun 8, 2017 at 9:36
  • 1
    @Gisnoob123 - it's better to copy & paste the text into the question rather than the images
    – Ian Turton
    Jun 8, 2017 at 9:42

1 Answer 1

5

Windows photo is not a GIS viewer and it does not know anything about georeferencing. Therefore is considers pixels as square.

However, as you can see from the gdalinfo report the pixel x and y size are not equal

Pixel Size = (0.068380000000000,-0.119760000000000)

I would say that you image is correct, QGIS is doing the right thing as GIS viewer and Windows photo is doing the right thing as photo viewer. If you want that image looks more natural with the photo viewer it should work simply by making the pixels square with gdal_translate:

gdal_translate -of png -tr 0.06838 0.06838 input.tif output.png

I guess that you have on-the-fly projection turned on in QGIS. If you disable it you should see the same squished image than with the photo viewer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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