*SPSS syntax example by www.spss-tutorials.com.

*SPSS Set Chart Sizes Tool - SPSS syntax version for SPSS versions 14 through 17.
*Requires SPSS Python Essentials in order to run.

*1. Define function.

begin program.
def setChartSizes(width,height,charts,filter):
    import SpssClient
    SpssClient.StartClient()
    oDoc = SpssClient.GetDesignatedOutputDoc()
    oItems = oDoc.GetOutputItems()
    for index in range(oItems.Size()):
        oItem = oItems.GetItemAt(oItems.Size() - index - 1)
        if oItem.GetType() == SpssClient.OutputItemType.CHART:
            if (not filter or filter.lower() == oItem.GetProcedureName().lower()):
                if width:
                    oItem.SetWidth(int(width) - 4)
                if height:
                    oItem.SetHeight(int(height) - 4)
            if charts == 'last':
                break
    SpssClient.StopClient()
end program.

*2. Use function (example).

begin program.
setChartSizes(width='800',height='400',charts = 'all',filter='frequencies')
end program.