[gdal-dev] convert dataType Byte to dataType Int32 on a raster file
paul.malm at lfv.se
paul.malm at lfv.se
Thu Oct 17 03:54:58 PDT 2024
Hi, I would like to change a tif file from datatype: Byte to DataType: I32, but when I open the original file and the new I32 file in QGis or in ArcMap there is a huge difference in the colors of the 2 files. How can I do this conversion without the color change?
I'v tried this:
gdal_translate.exe -if GTiff -of GTiff -ot Int32 -r cubicspline -co BIGTIFF=NO -co PIXELTYPE=DEFAULT -co GEOTIFF_VERSION=AUTO 34SCJ_8bit.tif 34SCJ_I32.tif
This is the info I can get from the orig file:
Driver: GTiff/GeoTIFF
Files: C:\Temp\raster\8bit\34SCJ_8bit.tif
C:\Temp\raster\8bit\34SCJ_8bit.tif.aux.xml
Size is 10008, 10008
Coordinate System is:
PROJCRS["WGS 84 / UTM zone 34N",
BASEGEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4326]],
CONVERSION["Transverse Mercator",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",0,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",21,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",0.9996,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",500000,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",0,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["easting",east,
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["northing",north,
ORDER[2],
LENGTHUNIT["metre",1]],
ID["EPSG",32634]]
Data axis to CRS axis mapping: 1,2
Origin = (300000.000000000000000,4400040.000000000000000)
Pixel Size = (10.000000000000000,-10.000000000000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
COMPRESSION=LZW
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( 300000.000, 4400040.000) ( 18d39'58.92"E, 39d43'36.50"N)
Lower Left ( 300000.000, 4299960.000) ( 18d41'45.91"E, 38d49'32.64"N)
Upper Right ( 400080.000, 4400040.000) ( 19d50' 1.59"E, 39d44'39.87"N)
Lower Right ( 400080.000, 4299960.000) ( 19d50'55.10"E, 38d50'34.02"N)
Center ( 350040.000, 4350000.000) ( 19d15'40.38"E, 39d17'11.02"N)
Band 1 Block=10008x105 Type=Byte, ColorInterp=Red
Min=1.000 Max=255.000 Computed Min/Max=1.000,255.000
Minimum=1.000, Maximum=255.000, Mean=5.891, StdDev=1.472
0...10...20...30...40...50...60...70...80...90...100 - done.
256 buckets from -0.5 to 255.5:
0 13 267 2628 12090 31819581 58258333 8351335 176703 271820 250415 191534 148851 117352 103280 90852 74508 59386 41300 29615 21648 15641 13667 10967 9286 7990 6907 6263 5475 5038 4631 4104 3460 3476 3203 3061 2699 2404 2413 2222 1989 1896 1657 1532 1474 1310 1123 1091 1034 966 843 863 733 598 644 564 528 527 429 446 399 377 345 334 309 292 252 290 223 196 197 174 163 129 132 143 122 99 89 67 79 77 70 43 57 63 41 40 59 45 42 32 27 22 29 19 24 24 18 18 14 13 9 13 12 12 15 8 9 9 6 2 9 8 11 2 8 8 7 6 4 3 1 3 3 0 0 1 1 2 3 0 3 1 1 1 1 1 0 0 0 1 0 1 0 1 0 1 1 0 0 0 0 0 0 4 1 1 0 0 1 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1
NoData Value=0
Overviews: 5004x5004, 2502x2502, 1251x1251, 626x626
Metadata:
STATISTICS_MAXIMUM=255
STATISTICS_MEAN=5.8911654638236
STATISTICS_MINIMUM=1
STATISTICS_STDDEV=1.4715321502251
STATISTICS_VALID_PERCENT=99.999
Band 2 Block=10008x105 Type=Byte, ColorInterp=Green
Min=2.000 Max=255.000 Computed Min/Max=2.000,255.000
Minimum=2.000, Maximum=255.000, Mean=9.691, StdDev=1.948
0...10...20...30...40...50...60...70...80...90...100 - done.
256 buckets from -0.5 to 255.5:
0 0 1 40 232 1278 3877 43219 9049592 43494182 32692965 12751080 429567 120698 174669 203890 189494 158254 124362 99749 77140 62272 53503 45863 43502 40181 41281 39217 36914 30406 24567 18666 14267 10864 8684 6714 5790 5221 4441 4199 3610 3495 2979 2924 2549 2454 2192 2100 1796 1849 1451 1396 1386 1193 1216 1015 1049 936 907 757 739 671 598 559 555 523 502 514 486 444 345 378 313 346 275 307 279 233 234 190 224 210 187 161 180 136 132 127 133 104 123 93 90 102 96 82 75 68 71 62 49 57 48 53 30 47 46 32 39 35 33 29 23 20 25 27 29 17 23 19 8 11 15 10 12 12 10 13 11 10 10 11 9 15 13 6 9 14 4 9 7 6 7 3 6 3 5 4 3 3 2 7 2 3 2 4 5 2 3 1 1 5 4 3 5 1 1 1 1 0 1 0 1 1 0 1 0 1 1 1 0 0 1 1 0 1 1 0 0 1 0 0 0 0 1 0 1 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 2 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1
NoData Value=0
Overviews: 5004x5004, 2502x2502, 1251x1251, 626x626
Metadata:
STATISTICS_MAXIMUM=255
STATISTICS_MEAN=9.6913154697197
STATISTICS_MINIMUM=2
STATISTICS_STDDEV=1.9477397794598
STATISTICS_VALID_PERCENT=99.999
Band 3 Block=10008x105 Type=Byte, ColorInterp=Blue
Min=1.000 Max=255.000 Computed Min/Max=1.000,255.000
Minimum=1.000, Maximum=255.000, Mean=16.263, StdDev=1.651
0...10...20...30...40...50...60...70...80...90...100 - done.
256 buckets from -0.5 to 255.5:
0 15 94 293 793 1648 2645 4618 8737 19397 43732 104770 197204 533502 4576246 23896028 32418889 22091697 11944542 3657334 288110 69053 54394 37892 29108 20913 17963 14943 13264 10641 9772 7949 7341 6153 5502 4881 4533 3847 3681 3360 3247 2814 2645 2477 2147 2151 1887 1852 1634 1605 1420 1358 1127 1170 1069 1054 873 846 781 791 601 698 597 532 517 509 495 467 408 392 373 324 315 299 325 221 273 221 218 208 188 176 176 152 156 157 124 126 132 113 86 94 101 97 101 79 92 79 68 65 58 73 57 57 49 42 45 51 48 40 38 32 30 32 25 17 33 19 16 24 18 21 16 21 18 19 15 19 11 15 10 10 3 15 10 10 12 5 13 12 6 6 7 9 7 8 6 4 4 7 7 7 8 6 4 8 1 4 5 6 2 3 2 5 1 4 4 3 3 5 4 1 3 1 1 0 2 1 3 2 2 2 3 2 4 5 2 2 3 1 2 0 1 1 1 1 3 0 1 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
NoData Value=0
Overviews: 5004x5004, 2502x2502, 1251x1251, 626x626
Metadata:
STATISTICS_MAXIMUM=255
STATISTICS_MEAN=16.26270377109
STATISTICS_MINIMUM=1
STATISTICS_STDDEV=1.6510387905849
STATISTICS_VALID_PERCENT=99.999
And this is the info from the result file:
Driver: GTiff/GeoTIFF
Files: C:\Temp\raster\8bit\34SCJ_I32.tif
Size is 10008, 10008
Coordinate System is:
PROJCRS["WGS 84 / UTM zone 34N",
BASEGEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4326]],
CONVERSION["UTM zone 34N",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",0,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",21,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",0.9996,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",500000,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",0,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["(E)",east,
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["(N)",north,
ORDER[2],
LENGTHUNIT["metre",1]],
USAGE[
SCOPE["Engineering survey, topographic mapping."],
AREA["Between 18°E and 24°E, northern hemisphere between equator and 84°N, onshore and offshore. Albania. Belarus. Bosnia and Herzegovina. Bulgaria. Central African Republic. Chad. Croatia. Democratic Republic of the Congo (Zaire). Estonia. Finland. Greece. Hungary. Italy. Kosovo. Latvia. Libya. Lithuania. Montenegro. North Macedonia. Norway, including Svalbard and Bjornoys. Poland. Romania. Russian Federation. Serbia. Slovakia. Sudan. Sweden. Ukraine."],
BBOX[0,18,84,24]],
ID["EPSG",32634]]
Data axis to CRS axis mapping: 1,2
Origin = (300000.000000000000000,4400040.000000000000000)
Pixel Size = (10.000000000000000,-10.000000000000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( 300000.000, 4400040.000) ( 18d39'58.92"E, 39d43'36.50"N)
Lower Left ( 300000.000, 4299960.000) ( 18d41'45.91"E, 38d49'32.64"N)
Upper Right ( 400080.000, 4400040.000) ( 19d50' 1.59"E, 39d44'39.87"N)
Lower Right ( 400080.000, 4299960.000) ( 19d50'55.10"E, 38d50'34.02"N)
Center ( 350040.000, 4350000.000) ( 19d15'40.38"E, 39d17'11.02"N)
Band 1 Block=10008x1 Type=Int32, ColorInterp=Red
Min=1.000 Max=255.000 Computed Min/Max=1.000,255.000
Minimum=1.000, Maximum=255.000, Mean=5.891, StdDev=1.472
0...10...20...30...40...50...60...70...80...90...100 - done.
256 buckets from 0.501961 to 255.498:
13 267 2628 12090 31819581 58258333 8351335 176703 271820 250415 191534 148851 117352 103280 90852 74508 59386 41300 29615 21648 15641 13667 10967 9286 7990 6907 6263 5475 5038 4631 4104 3460 3476 3203 3061 2699 2404 2413 2222 1989 1896 1657 1532 1474 1310 1123 1091 1034 966 843 863 733 598 644 564 528 527 429 446 399 377 345 334 309 292 252 290 223 196 197 174 163 129 132 143 122 99 89 67 79 77 70 43 57 63 41 40 59 45 42 32 27 22 29 19 24 24 18 18 14 13 9 13 12 12 15 8 9 9 6 2 9 8 11 2 8 8 7 6 4 3 1 3 3 0 0 1 0 1 2 3 0 3 1 1 1 1 1 0 0 0 1 0 1 0 1 0 1 1 0 0 0 0 0 0 4 1 1 0 0 1 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1
NoData Value=0
Metadata:
STATISTICS_MAXIMUM=255
STATISTICS_MEAN=5.8911654638236
STATISTICS_MINIMUM=1
STATISTICS_STDDEV=1.4715321502251
STATISTICS_VALID_PERCENT=99.999
Band 2 Block=10008x1 Type=Int32, ColorInterp=Green
Min=2.000 Max=255.000 Computed Min/Max=2.000,255.000
Minimum=2.000, Maximum=255.000, Mean=9.691, StdDev=1.948
0...10...20...30...40...50...60...70...80...90...100 - done.
256 buckets from 1.50392 to 255.496:
1 40 232 1278 3877 43219 9049592 43494182 32692965 12751080 429567 120698 174669 203890 189494 158254 124362 99749 77140 62272 53503 45863 43502 40181 41281 39217 36914 30406 24567 18666 14267 10864 8684 6714 5790 5221 4441 4199 3610 3495 2979 2924 2549 2454 2192 2100 1796 1849 1451 1396 1386 1193 1216 1015 1049 936 907 757 739 671 598 559 555 523 0 502 514 486 444 345 378 313 346 275 307 279 233 234 190 224 210 187 161 180 136 132 127 133 104 123 93 90 102 96 82 75 68 71 62 49 57 48 53 30 47 46 32 39 35 33 29 23 20 25 27 29 17 23 19 8 11 15 10 12 12 10 13 11 10 10 11 9 15 13 6 9 14 4 9 7 6 7 3 6 3 5 4 3 3 2 7 2 3 2 4 5 2 3 1 1 5 4 3 5 1 1 1 1 0 1 0 1 1 0 1 0 1 1 1 0 0 1 1 0 1 1 0 0 1 0 0 0 0 0 1 0 1 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 2 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1
NoData Value=0
Metadata:
STATISTICS_MAXIMUM=255
STATISTICS_MEAN=9.6913154697197
STATISTICS_MINIMUM=2
STATISTICS_STDDEV=1.9477397794598
STATISTICS_VALID_PERCENT=99.999
Band 3 Block=10008x1 Type=Int32, ColorInterp=Blue
Min=1.000 Max=255.000 Computed Min/Max=1.000,255.000
Minimum=1.000, Maximum=255.000, Mean=16.263, StdDev=1.651
0...10...20...30...40...50...60...70...80...90...100 - done.
256 buckets from 0.501961 to 255.498:
15 94 293 793 1648 2645 4618 8737 19397 43732 104770 197204 533502 4576246 23896028 32418889 22091697 11944542 3657334 288110 69053 54394 37892 29108 20913 17963 14943 13264 10641 9772 7949 7341 6153 5502 4881 4533 3847 3681 3360 3247 2814 2645 2477 2147 2151 1887 1852 1634 1605 1420 1358 1127 1170 1069 1054 873 846 781 791 601 698 597 532 517 509 495 467 408 392 373 324 315 299 325 221 273 221 218 208 188 176 176 152 156 157 124 126 132 113 86 94 101 97 101 79 92 79 68 65 58 73 57 57 49 42 45 51 48 40 38 32 30 32 25 17 33 19 16 24 18 21 16 21 18 19 15 19 0 11 15 10 10 3 15 10 10 12 5 13 12 6 6 7 9 7 8 6 4 4 7 7 7 8 6 4 8 1 4 5 6 2 3 2 5 1 4 4 3 3 5 4 1 3 1 1 0 2 1 3 2 2 2 3 2 4 5 2 2 3 1 2 0 1 1 1 1 3 0 1 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
NoData Value=0
Metadata:
STATISTICS_MAXIMUM=255
STATISTICS_MEAN=16.26270377109
STATISTICS_MINIMUM=1
STATISTICS_STDDEV=1.6510387905849
STATISTICS_VALID_PERCENT=99.999
Kind regards,
Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20241017/932f551c/attachment-0001.htm>
More information about the gdal-dev
mailing list