I want to create a georeferenced .tiff file from a .png file. So I convert the .png into a normal .tiff file using the following command line :

convert image.png image.tiff

Here, all works fine, I have a valid .tiff file, which displays fine. Then, I want to add some georeferencing data in it. To do so, I found a tool called tiff2geotiff, I'm using it like this :

tiff2geotiff -4 "+proj=latlong +ellps=WGS84 +datum=WGS84 +no_defs" -c none -n "-122.5575664 38.5818201 -122.5449425 38.5896175" notgeoreferenced.tiff georeferenced.tiff

This gives me a black image which, imported in QGis, displays fine in the good place, except that it's black everywhere (proof that the georeferenced data have been well added).

Therefore, when I do :

gdalinfo georeferenced.tiff

I obtain :

Warning 1: TIFFReadDirectory:Bogus "StripByteCounts" field, ignoring and calculating from imagelength
Driver: GTiff/GeoTIFF
Files: araujo_tmp.tiff
Size is 1585, 979
Coordinate System is:
        SPHEROID["WGS 84",6378137,298.257223563,
Origin = (-122.557563781738281,38.589618682861328)
Pixel Size = (0.000007966552118,-0.000007972639275)
Image Structure Metadata:
Corner Coordinates:
Upper Left  (-122.5575638,  38.5896187) (122d33'27.23"W, 38d35'22.63"N)
Lower Left  (-122.5575638,  38.5818135) (122d33'27.23"W, 38d34'54.53"N)
Upper Right (-122.5449368,  38.5896187) (122d32'41.77"W, 38d35'22.63"N)
Lower Right (-122.5449368,  38.5818135) (122d32'41.77"W, 38d34'54.53"N)
Center      (-122.5512503,  38.5857161) (122d33' 4.50"W, 38d35' 8.58"N)
Band 1 Block=1585x1 Type=Byte, ColorInterp=Red
Band 2 Block=1585x1 Type=Byte, ColorInterp=Green
Band 3 Block=1585x1 Type=Byte, ColorInterp=Blue

I think the first warning may be the problem...

Is there someone who knows why or another way to do this ? I'm looking for solutions in command line or in PHP.


I found out gdal_translate can add georeferencing data into .tiff images, so here is the command line which convert from png and add georeferencing data (you have to replace the extents (llx ury urx lly), of course):

gdal_translate -a_nodata 0 -of GTiff -a_srs EPSG:4326 -a_ullr llx ury urx lly pngfile.png tifffile.tiff

2 Answers 2


Rather than using convert, could you try to use gdal_translate to convert the png to tiff and then georeference it using gdal_warp (assuming you've created a tfw file for the tiff)?

  • Here is the command line I use now : gdal_translate -scale pngfile.png tifffile.tiff Commented Sep 25, 2012 at 10:52

Do you know the extents of the image? If you know the bounding coordinates of the image you can us gdal_translate with the -a_srs (this assigns the projection) and -a_ullr (this is the bounding coordinates). I have used this to convert .jpg of sonar images from a low cost fishing sonar unit to geotiffs.

  • 2
    So you're saying that I don't need to use tiff2geotiff to add the extents of the image (yes I have them) ? :) Cool ! Yes I see that in the documentation, I will use it instead of tiff2geotiff, thank you ! Commented Sep 27, 2012 at 9:05
  • No problem, I am glad this will help Commented Sep 27, 2012 at 14:22

Your Answer

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

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