Skip to content

Commit ed90055

Browse files
committed
homogenize worldfile extensions when exporting map as image (fix #13264)
1 parent e5d8529 commit ed90055

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/gui/qgsmapcanvas.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -891,8 +891,10 @@ void QgsMapCanvas::saveAsImage( const QString& theFileName, QPixmap * theQPixmap
891891
//Origin Y (center of top left cell)
892892
myHeader += qgsDoubleToString( myRect.yMaximum() - ( mapUnitsPerPixel() / 2 ) ) + "\r\n";
893893
QFileInfo myInfo = QFileInfo( theFileName );
894-
// allow dotted names
895-
QString myWorldFileName = myInfo.absolutePath() + '/' + myInfo.completeBaseName() + '.' + theFormat + 'w';
894+
// build the world file name
895+
QString outputSuffix = myInfo.suffix();
896+
QString myWorldFileName = myInfo.absolutePath() + '/' + myInfo.baseName() + '.'
897+
+ outputSuffix.at( 0 ) + outputSuffix.at( myInfo.suffix().size() - 1 ) + 'w';
896898
QFile myWorldFile( myWorldFileName );
897899
if ( !myWorldFile.open( QIODevice::WriteOnly ) ) //don't use QIODevice::Text
898900
{

0 commit comments

Comments
 (0)