-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tiff decode result is wrong! #101
Comments
Thank you for the report! For some reason I cannot reproduce your results. I've downloaded the TIFF file using the above link (qdcaichu.tif). I'm not sure what does Here are the md5 and sha256 checksums of the downloaded file:
I've modified your code slightly to add error handling and to make it a runnable example.
I get the following image decoding error when running this example:
Looks like the I get the same result when using the
|
Thank you. go run main.go
2019/08/01 14:13:05 failed to open image: image: unknown format
exit status 1 golang.org/x/image/tiff go run main.go
2019/08/01 14:10:25 failed to decode image: tiff: invalid format: malformed header If converted into common TIFF, rather than BIGTIFF there is no error. I can read this image using the GDAL library. > gdalinfo qdcaichu.tif
Driver: GTiff/GeoTIFF
Files: qdcaichu.tif
Size is 4150, 3131
Coordinate System is:
PROJCS["Xian_1980_3_Degree_GK_Zone_40",
GEOGCS["GCS_Xian_1980",
DATUM["Xian_1980",
SPHEROID["Xian_1980",6378140,298.257,
AUTHORITY["EPSG","7049"]],
AUTHORITY["EPSG","6610"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",120],
PARAMETER["scale_factor",1],
PARAMETER["false_easting",40500000],
PARAMETER["false_northing",0],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]]]
Origin = (40526979.924999997019768,3992527.875000000000000)
Pixel Size = (0.150000000000000,-0.149999999999970)
Metadata:
AREA_OR_POINT=Area
DataType=Generic
Image Structure Metadata:
COMPRESSION=LZW
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left (40526979.925, 3992527.875) (120d17'58.09"E, 36d 3'45.22"N)
Lower Left (40526979.925, 3992058.225) (120d17'58.03"E, 36d 3'29.99"N)
Upper Right (40527602.425, 3992527.875) (120d18'22.96"E, 36d 3'45.16"N)
Lower Right (40527602.425, 3992058.225) (120d18'22.90"E, 36d 3'29.92"N)
Center (40527291.175, 3992293.050) (120d18'10.50"E, 36d 3'37.57"N)
Band 1 Block=128x128 Type=Byte, ColorInterp=Red
NoData Value=0
Band 2 Block=128x128 Type=Byte, ColorInterp=Green
NoData Value=0
Band 3 Block=128x128 Type=Byte, ColorInterp=Blue
NoData Value=0 |
Do I need to do any additional conversion steps on the image before running the examples? I've tried a few different versions of |
@disintegration I converted it to normal TIFF and BIGTIFF using thegdal_translate. gdal_translate -of GTiff qdcaichu.tif qdcaichu_1.tif converted it to BIGTIFF gdal_translate -of GTiff -co "BIGTIFF=YES" qdcaichu.tif qdcaichu_1.tif |
Sorry for the late reply. I was away from computers for the last two weeks. I just did what you suggested:
Now the example code works with
Here's the output image ( The output image you've attached to the first message looks truncated though. Maybe you need to flush the buffered writer? |
Thank you. gdal_translate -of GTiff -co "BIGTIFF=YES" qdcaichu.tif qdcaichu_1.tif |
Running the example code on BigTIFF version of the image I get the same error as you do:
It means that this type of image is not supported by The |
Yeah, if you take a look at the Go issue tracker you are going to find a lot of issues with the TIFF package. The worst part of it is that since TIFF is still part of golang.org/x issues can take a long time to be fixed. |
I'm closing the issue now. It looks like it's not relevant to the |
When my picture is GeoTiff(128x128 BlockSize LZW compress), the Resize result is wrong.
code:
Output Result:
Origin Picture:
As long as you convert this image to another format or save another copy, there is no error. But software such as GlobalMap can be read correctly.
Origin file:https://c-t.work/s/77dc0228ef574e
Number: 322420
The text was updated successfully, but these errors were encountered: