Skip to content

Commit

Permalink
Set DPI of rendered images
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed May 9, 2020
1 parent da042bb commit 83a12fb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/qgsmaprendererjob.cpp
Expand Up @@ -703,6 +703,8 @@ QImage QgsMapRendererJob::composeImage( const QgsMapSettings &settings, const La
{
QImage image( settings.deviceOutputSize(), settings.outputImageFormat() );
image.setDevicePixelRatio( settings.devicePixelRatio() );
image.setDotsPerMeterX( static_cast<int>( settings.outputDpi() * 39.37 ) );
image.setDotsPerMeterY( static_cast<int>( settings.outputDpi() * 39.37 ) );
image.fill( settings.backgroundColor().rgba() );

QPainter painter( &image );
Expand Down

0 comments on commit 83a12fb

Please sign in to comment.