Skip to content

Commit

Permalink
GTiff/COG writer: add hint about NBITS creation option to specify to …
Browse files Browse the repository at this point in the history
…be compatible of PREDICTOR creation option

Fixes #11457
  • Loading branch information
rouault committed Dec 8, 2024
1 parent 04b227e commit a14b7be
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions frmts/gtiff/gtiffdataset_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5323,15 +5323,23 @@ TIFF *GTiffDataset::CreateLL(const char *pszFilename, int nXSize, int nYSize,
else
#endif
{
const int nBITSHint = (l_nBitsPerSample < 8) ? 8
: (l_nBitsPerSample < 16) ? 16
: (l_nBitsPerSample < 32) ? 32
: 64;
ReportError(pszFilename, CE_Failure, CPLE_AppDefined,
#ifdef HAVE_PREDICTOR_2_FOR_64BIT
"PREDICTOR=2 is only supported with 8/16/32/64 "
"bit samples."
"bit samples. You can specify the NBITS=%d "
"creation option to promote to the closest "
"supported bits per sample value.",
#else
"PREDICTOR=2 is only supported with 8/16/32 "
"bit samples."
"bit samples. You can specify the NBITS=%d "
"creation option to promote to the closest "
"supported bits per sample value.",
#endif
);
nBITSHint);
}
return nullptr;
}
Expand Down

0 comments on commit a14b7be

Please sign in to comment.