forked from openlp/openlp
fixed variable name
bzr-revno: 2012
This commit is contained in:
commit
4e158ed8f0
@ -265,14 +265,15 @@ def resize_image(image_path, width, height, background=u'#000000'):
|
|||||||
if image_ratio == resize_ratio:
|
if image_ratio == resize_ratio:
|
||||||
# We neither need to centre the image nor add "bars" to the image.
|
# We neither need to centre the image nor add "bars" to the image.
|
||||||
return preview
|
return preview
|
||||||
realw = preview.width()
|
real_width = preview.width()
|
||||||
realh = preview.height()
|
real_height = preview.height()
|
||||||
# and move it to the centre of the preview space
|
# and move it to the centre of the preview space
|
||||||
new_image = QtGui.QImage(width, height,
|
new_image = QtGui.QImage(width, height,
|
||||||
QtGui.QImage.Format_ARGB32_Premultiplied)
|
QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||||
painter = QtGui.QPainter(new_image)
|
painter = QtGui.QPainter(new_image)
|
||||||
painter.fillRect(new_image.rect(), QtGui.QColor(background))
|
painter.fillRect(new_image.rect(), QtGui.QColor(background))
|
||||||
painter.drawImage((width - realw) / 2, (height - realh) / 2, preview)
|
painter.drawImage(
|
||||||
|
(width - real_width) / 2, (height - real_height) / 2, preview)
|
||||||
return new_image
|
return new_image
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user