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

Stephen Woodbridge stephenwoodbridge37 at gmail.com
Sun Jul 1 08:18:39 PDT 2018


Right, but the point 1 is the message says:
ERROR 6: PHOTOMETRIC=YCBCR requires a source raster with only 3 bands (RGB)
ie: requires a source raster with only 3 bands (RGB) and the source 
raster has only 3 bands!
-dstalpha if I understand correctly is to create a alpha band in the 
output file. So the error message is misleading at best.

Point 2 is how does one translate a utm to wgs84 using YCBCR and 
generate an appropriate mask or alpha channel to hide the pixels that 
are outside the transformed image. I suppose it needs to be done in 
multiple steps of warp and translate in some specific order with 
specific options but its not obvious how.

-Steve

On 7/1/2018 10:14 AM, Michael Smith wrote:
> 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