Original image
New Image
Problem Statement
Suppose the original pixmap is of 300x300, and I want it to be extended in y axis by 200 pixels, new image being 300x500 pixels. How can I do it?
# Current
pixmap = QtGui.QPixmap(WIDTH, HEIGHT)
pixmap.fill(Qt.transparent)
self.setPixmap(pixmap)
# New
pixmap = self.pixmap().scaled(
WIDTH,
NEW_HEIGHT,
Qt.IgnoreAspectRatio,
Qt.SmoothTransformation)
self.setPixmap(pixmap)
Things I tried:
- Rescaling, but it only stretches the whole image to that resolution and distorts the image
- I can create a new blank canvas of the new resolution, and ask the user to redraw or rewrite on the canvas again but it will be very inconvinient
Application: I will be using this in my paint app, I am adding a scroll bar with my canvas, and with a button you can extend the canvas downwards and keep writing/drawing. The app is build on PyQt.

