Skip to content
Permalink
Browse files

More efficient image size calculation for base64 encoded images

  • Loading branch information
nyalldawson committed Dec 5, 2018
1 parent 9d28a96 commit 7a5f5535799743c7a6d4638fb8e993fa5caba563
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/core/qgsimagecache.cpp
@@ -160,6 +160,11 @@ QSize QgsImageCache::originalSize( const QString &path ) const
buffer.open( QIODevice::ReadOnly );

QImageReader reader( &buffer );
// if QImageReader::size works, then it's more efficient as it doesn't
// read the whole image (see Qt docs)
const QSize s = reader.size();
if ( s.isValid() )
return s;
QImage im = reader.read();
return im.isNull() ? QSize() : im.size();
}

0 comments on commit 7a5f553

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