[gdal-dev] gdalwarp ERROR 6: PHOTOMETRIC=YCBCR requires a source raster with only 3 bands (RGB)

Michael Smith michael.smith.erdc at gmail.com
Sun Jul 1 07:14:18 PDT 2018


Steve,

Setting that alpha channel makes it 4 bands. RGB + alpha channel. Either remove the ycbcr or the alpha channel. 

Michael Smith
Remote Sensing/GIS Center
US Army Corps of Engineers

> On Jul 1, 2018, at 10:07 AM, Stephen Woodbridge <stephenwoodbridge37 at gmail.com> wrote:
> 
> Hi all,
> 
> I'm trying to convert a utm jp2 file to a wgs84 tif file and getting "ERROR 6: PHOTOMETRIC=YCBCR requires a source raster with only 3 bands (RGB)" but the src file has only 3 RBG bands.
> 
> gdalwarp -t_srs EPSG:4326 -dstalpha -r bilinear -of GTiff -co BIGTIFF=YES -co TILED=YES -co COMPRESS=JPEG -co JPEG_QUALITY=90 -co PHOTOMETRIC=YCBCR '00010.jp2' 'tif/00010.tif'
> 
> The command works if I remove -dstalpha so it seems that the error message is erroneous and might need fixed. Regardless, I don't want the transformed image to have black around it, so how do I do that?
> 
> -Steve
> 
> # gdalinfo 00010.jp2
> Driver: JP2OpenJPEG/JPEG-2000 driver based on OpenJPEG library
> Files: 00010.jp2
>        00010.jp2.aux.xml
> Size is 340668, 65335
> Coordinate System is:
> PROJCS["UTM_Zone_38_Northern_Hemisphere",
>     GEOGCS["GCS_WGS_1984",
>         DATUM["WGS84",
>             SPHEROID["WGS84",6378137,298.257223563]],
>         PRIMEM["Greenwich",0],
>         UNIT["Degree",0.017453292519943295]],
>     PROJECTION["Transverse_Mercator"],
>     PARAMETER["latitude_of_origin",0],
>     PARAMETER["central_meridian",45],
>     PARAMETER["scale_factor",0.9996],
>     PARAMETER["false_easting",500000],
>     PARAMETER["false_northing",0],
>     UNIT["Meter",1]]
> Origin = (265998.000000000000000,1848002.000000000000000)
> Pixel Size = (3.000000000000000,-3.000000000000000)
> Image Structure Metadata:
>   INTERLEAVE=PIXEL
> Corner Coordinates:
> Upper Left  (  265998.000, 1848002.000) ( 42d48'19.81"E, 16d42'11.25"N)
> Lower Left  (  265998.000, 1651997.000) ( 42d49'28.30"E, 14d55'56.73"N)
> Upper Right ( 1288002.000, 1848002.000) ( 52d22'11.02"E, 16d35' 0.58"N)
> Lower Right ( 1288002.000, 1651997.000) ( 52d18'23.31"E, 14d49'33.87"N)
> Center      (  777000.000, 1749999.500) ( 47d35' 9.06"E, 15d48'48.25"N)
> Band 1 Block=1024x1024 Type=Byte, ColorInterp=Red
>   Overviews: 170334x32667, 85167x16333, 42583x8166, 21291x4083, 10645x2041
>   Overviews: arbitrary
>   Image Structure Metadata:
>     COMPRESSION=JPEG2000
> Band 2 Block=1024x1024 Type=Byte, ColorInterp=Green
>   Overviews: 170334x32667, 85167x16333, 42583x8166, 21291x4083, 10645x2041
>   Overviews: arbitrary
>   Image Structure Metadata:
>     COMPRESSION=JPEG2000
> Band 3 Block=1024x1024 Type=Byte, ColorInterp=Blue
>   Overviews: 170334x32667, 85167x16333, 42583x8166, 21291x4083, 10645x2041
>   Overviews: arbitrary
>   Image Structure Metadata:
>     COMPRESSION=JPEG2000
> 
> 
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list