Skip to content
Permalink
Browse files

-Applied patch supplied by rouault to allow building internal pyramid…

…s jpeg compression if libtiff 4.0 or greater is available

-Closes ticket #1357

git-svn-id: http://svn.osgeo.org/qgis/trunk@11187 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
ersts
ersts committed Jul 28, 2009
1 parent 9cb3b3f commit 1c15572f80927754820663eee826bdfb9358a397
Showing with 14 additions and 5 deletions.
  1. +1 −1 src/app/qgsrasterlayerproperties.cpp
  2. +13 −4 src/core/raster/qgsrasterlayer.cpp
@@ -1572,7 +1572,7 @@ void QgsRasterLayerProperties::on_buttonBuildPyramids_clicked()
else if ( res == "ERROR_JPEG_COMPRESSION" )
{
QMessageBox::warning( this, tr( "Building pyramids failed." ),
tr( "Building internal pyramid overviews is not supported on raster layers with JPEG compression." ) );
tr( "Building internal pyramid overviews is not supported on raster layers with JPEG compression and your current libtiff library." ) );
}
else if ( res == "ERROR_VIRTUAL" )
{
@@ -1014,11 +1014,20 @@ QString QgsRasterLayer::buildPyramids( RasterPyramidList const & theRasterPyrami

if ( theTryInternalFlag )
{
QString myCompressionType = QString( GDALGetMetadataItem( mGdalDataset, "COMPRESSION", "IMAGE_STRUCTURE" ) );
if ( "JPEG" == myCompressionType )
// libtiff < 4.0 has a bug that prevents safe building of overviews on JPEG compressed files
// we detect libtiff < 4.0 by checking that BIGTIFF is not in the creation options of the GTiff driver
// see https://trac.osgeo.org/qgis/ticket/1357
const char* pszGTiffCreationOptions =
GDALGetMetadataItem( GDALGetDriverByName( "GTiff" ), GDAL_DMD_CREATIONOPTIONLIST, "" );
if ( strstr( pszGTiffCreationOptions, "BIGTIFF" ) == NULL )
{
return "ERROR_JPEG_COMPRESSION";
QString myCompressionType = QString( GDALGetMetadataItem( mGdalDataset, "COMPRESSION", "IMAGE_STRUCTURE" ) );
if ( "JPEG" == myCompressionType )
{
return "ERROR_JPEG_COMPRESSION";
}
}

//close the gdal dataset and reopen it in read / write mode
GDALClose( mGdalDataset );
mGdalBaseDataset = GDALOpen( QFile::encodeName( mDataSource ).constData(), GA_Update );
@@ -1501,7 +1510,7 @@ bool QgsRasterLayer::draw( QgsRenderContext& rendererContext )

emit statusChanged( tr( "Retrieving using %1" ).arg( mProviderKey ) );

mDataProvider->setDpi(rendererContext.rasterScaleFactor() * 25.4 * rendererContext.scaleFactor());
mDataProvider->setDpi( rendererContext.rasterScaleFactor() * 25.4 * rendererContext.scaleFactor() );

QImage* image =
mDataProvider->draw(

0 comments on commit 1c15572

Please sign in to comment.
You can’t perform that action at this time.