Boa tarde,

Penso que o mais simples será criar um raster virtual com transparência, e
posteriormente fazer a conversão deste para tif

Exemplo:

1. gdalbuildvrt -srcnodata "255 255 255" destino.vrt entrada.jpg
2. gdal_translate -of Gtiff destino.vrt destino.tif

Cumprimentos,
Pedro Monteiro

On Wed, Oct 19, 2016 at 2:13 PM Marco Afonso <mafonso...@gmail.com> wrote:

> Boa tarde,
>
> Julgo que a questão será direccionada para os GDAL masters :)
>
> Gostaria de saber se é possível converter um ficheiro no formato JP2000
> para TIF com transparência. Se possível definir a côr branco (RGB 255 255
> 255) para transparência.
>
> Compressão para o ficheiro de saída TIF não é requisito para já.
>
> Segue a informação obtida pelo GDALINFO do ficheiro de origem.
>
> Obrigado! :)
>
> Driver: JP2MrSID/MrSID JPEG2000
> Files: pu_luz_zonamento.jp2
>        pu_luz_zonamento.jp2.ovr
>        pu_luz_zonamento.jp2.aux.xml
> Size is 6636, 6122
> Coordinate System is:
> PROJCS["ETRS_1989_TM06-Portugal",
>     GEOGCS["GCS_ETRS_1989",
>         DATUM["European_Terrestrial_Reference_System_1989",
>             SPHEROID["GRS_1980",6378137,298.257222101,
>                 AUTHORITY["EPSG","7019"]],
>             AUTHORITY["EPSG","6258"]],
>         PRIMEM["Greenwich",0],
>         UNIT["degree",0.0174532925199433]],
>     PROJECTION["Transverse_Mercator"],
>     PARAMETER["latitude_of_origin",39.66825833333333],
>     PARAMETER["central_meridian",-8.133108333333333],
>     PARAMETER["scale_factor",1],
>     PARAMETER["false_easting",0],
>     PARAMETER["false_northing",0],
>     UNIT["metre",1,
>         AUTHORITY["EPSG","9001"]]]
> Origin = (37881.833519887965000,-285245.409715688320000)
> Pixel Size = (0.169333333333329,-0.169333333333331)
> Metadata:
>   Corder=PCRL
>   GEOTIFF_CHAR__GeogAngularUnitsGeoKey=Angular_Degree
>
> GEOTIFF_CHAR__GeogGeodeticDatumGeoKey=Datum_European_Reference_System_1989
>   GEOTIFF_CHAR__GeographicTypeGeoKey=User-Defined
>   GEOTIFF_CHAR__GTModelTypeGeoKey=ModelTypeProjected
>   GEOTIFF_CHAR__GTRasterTypeGeoKey=RasterPixelIsArea
>   GEOTIFF_CHAR__ProjCoordTransGeoKey=CT_TransverseMercator
>   GEOTIFF_CHAR__ProjectedCSTypeGeoKey=User-Defined
>   GEOTIFF_CHAR__ProjectionGeoKey=User-Defined
>   GEOTIFF_CHAR__ProjLinearUnitsGeoKey=Linear_Meter
>   GEOTIFF_NUM__1024__GTModelTypeGeoKey=1
>   GEOTIFF_NUM__1025__GTRasterTypeGeoKey=1
>   GEOTIFF_NUM__1026__GTCitationGeoKey=PCS Name = ETRS_1989_TM06-Portugal
>   GEOTIFF_NUM__2048__GeographicTypeGeoKey=32767
>   GEOTIFF_NUM__2049__GeogCitationGeoKey=GCS Name = GCS_ETRS_1989|Ellipsoid
> = GRS_1980|Primem = Greenwich|
>   GEOTIFF_NUM__2050__GeogGeodeticDatumGeoKey=6258
>   GEOTIFF_NUM__2054__GeogAngularUnitsGeoKey=9102
>   GEOTIFF_NUM__2057__GeogSemiMajorAxisGeoKey=6378137.000000
>   GEOTIFF_NUM__2059__GeogInvFlatteningGeoKey=298.257222
>   GEOTIFF_NUM__2061__GeogPrimeMeridianLongGeoKey=0.000000
>   GEOTIFF_NUM__3072__ProjectedCSTypeGeoKey=32767
>   GEOTIFF_NUM__3074__ProjectionGeoKey=32767
>   GEOTIFF_NUM__3075__ProjCoordTransGeoKey=1
>   GEOTIFF_NUM__3076__ProjLinearUnitsGeoKey=9001
>   GEOTIFF_NUM__3080__ProjNatOriginLongGeoKey=-8.133108
>   GEOTIFF_NUM__3081__ProjNatOriginLatGeoKey=39.668258
>   GEOTIFF_NUM__3082__ProjFalseEastingGeoKey=0.000000
>   GEOTIFF_NUM__3083__ProjFalseNorthingGeoKey=0.000000
>   GEOTIFF_NUM__3092__ProjScaleAtNatOriginGeoKey=1.000000
> Image Structure Metadata:
>   INTERLEAVE=PIXEL
> Corner Coordinates:
> Upper Left  (   37881.834, -285245.410 <285%20245%20410>) (
>  7d42'25.13"W, 37d 5'52.09"N)
> Lower Left  (   37881.834, -286282.068 <286%20282%20068>) (
>  7d42'25.32"W, 37d 5'18.46"N)
> Upper Right (   39005.530, -285245.410 <285%20245%20410>) (
>  7d41'39.62"W, 37d 5'51.92"N)
> Lower Right (   39005.530, -286282.068 <286%20282%20068>) (
>  7d41'39.82"W, 37d 5'18.29"N)
> Center      (   38443.682, -285763.739 <285%20763%20739>) (  7d42'
> 2.47"W, 37d 5'35.19"N)
> Band 1 Block=1024x128 Type=Byte, ColorInterp=Red
>   Min=0.000 Max=255.000
>   Minimum=0.000, Maximum=255.000, Mean=236.038, StdDev=66.045
>   NoData Value=256
>   Overviews: 3318x3061, 1659x1531, 830x766, 415x383, 208x192
>   Metadata:
>
> STATISTICS_COVARIANCES=4361.995430900208,2244.864802420663,3368.225850604773
>     STATISTICS_MAXIMUM=255
>     STATISTICS_MEAN=236,03793160725
>     STATISTICS_MINIMUM=0
>     STATISTICS_SKIPFACTORX=1
>     STATISTICS_SKIPFACTORY=1
>     STATISTICS_STDDEV=66,045404313247
>   Image Structure Metadata:
>     COMPRESSION=JP2000
> Band 2 Block=1024x128 Type=Byte, ColorInterp=Green
>   Min=0.000 Max=255.000
>   Minimum=0.000, Maximum=255.000, Mean=218.476, StdDev=87.277
>   NoData Value=256
>   Overviews: 3318x3061, 1659x1531, 830x766, 415x383, 208x192
>   Metadata:
>
> STATISTICS_COVARIANCES=2244.864802420663,7617.276745283226,7051.036243014802
>     STATISTICS_MAXIMUM=255
>     STATISTICS_MEAN=218,47574597805
>     STATISTICS_MINIMUM=0
>     STATISTICS_SKIPFACTORX=1
>     STATISTICS_SKIPFACTORY=1
>     STATISTICS_STDDEV=87,277011551056
>   Image Structure Metadata:
>     COMPRESSION=JP2000
> Band 3 Block=1024x128 Type=Byte, ColorInterp=Blue
>   Min=0.000 Max=255.000
>   Minimum=0.000, Maximum=255.000, Mean=215.145, StdDev=92.105
>   NoData Value=256
>   Overviews: 3318x3061, 1659x1531, 830x766, 415x383, 208x192
>   Metadata:
>
> STATISTICS_COVARIANCES=3368.225850604773,7051.036243014802,8483.403263628108
>     STATISTICS_MAXIMUM=255
>     STATISTICS_MEAN=215,14531106402
>     STATISTICS_MINIMUM=0
>     STATISTICS_SKIPFACTORX=1
>     STATISTICS_SKIPFACTORY=1
>     STATISTICS_STDDEV=92,105392152838
>   Image Structure Metadata:
>     COMPRESSION=JP2000
>
>
> --
> Regards,
> Marco Afonso
> http://goo.gl/ZDtQjm
>
> _______________________________________________
> Portugal mailing list
> Portugal@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/portugal
_______________________________________________
Portugal mailing list
Portugal@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/portugal

Responder a