Some WMS connections in QGIS offer a variety of image encodings and sometimes from am list [PNG, PNG8, JPEG, GIF, TIFF, SVG] JPEG ist selected per default, like shown below, sometimes PNG is selected per default.

Note that the default is selected any time one connects to the WMS an cannot be overridden by selecting another option.

Example #1: default JPEG

enter image description here

Example #2:default PNG

enter image description here

The default image encoding seems not defined in the WMS' capabilities, nor am I able to define it when adding a WMS connection manually or via PyQGIS like

wms = {'Digitales Orthophoto 80cm (LDBV)':[('', '', ''),(7, False, False, False, False, '', False, 'https://geoservices.bayern.de/wms/v2/ogc_dop80_oa.cgi')]}
set = QgsSettings()
wms_exist = set.childGroups()
wms_cons = wms.keys()
for w in wms_cons:
    if not w in wms_exist:
        auth, params = wms[w]
        authid, user, pwd = auth
        dpi, iaxis, igfi, igmu, invaxis, ref, smooth, url = params
        wms_auth_path = 'qgis/WMS/{0}/'.format(w)
        set.setValue(wms_auth_path + 'authcfg', auth)
        set.setValue(wms_auth_path + 'password', pwd)
        set.setValue(wms_auth_path + 'username', user)
        wms_conf_path = 'qgis/connections-wms/{0}/'.format(w)
        set.setValue(wms_conf_path + 'dpiMode', dpi)
        set.setValue(wms_conf_path + 'ignoreAxisOrientation', iaxis)
        set.setValue(wms_conf_path + 'ignoreGetFeatureInfoURI', igfi)
        set.setValue(wms_conf_path + 'ignoreGetMapURI', igmu)
        set.setValue(wms_conf_path + 'invertAxisOrientation', invaxis)
        set.setValue(wms_conf_path + 'referer', ref)
        set.setValue(wms_conf_path + 'smoothPixmapTransform', smooth)
        set.setValue(wms_conf_path + 'url', url)

Since JPEG and PNG are available in both examples and the default values differ, the following question arises:

Q: How does QGIS determine the default image encoding and (if at all) how am I able to force QGIS to select PNG as default if available?

1 Answer 1


I think QGIS default format is the first getMap format from service. I have same problem, the default of QGIS was TIFF... I change the order of the getMap format in my MapServer service. I put PNG first before TIF and now the default in QGIS is PNG. Now PNG is first format getMap from service and is default in QGIS.

Service capabilities, PNG first:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.