PDA

View Full Version : How do I scale an image without it pixelating?



ayanda83
12th April 2015, 11:34
Hi guys, I have an image of size 421x595 and I want to display this image in my application at size 632x893 but I don't want the image to pixelate. I would like it to keep its original resolution. Can this be done? I am displaying the image as a QImage in a QGraphicsScene.

thanking you in advance.

wysota
12th April 2015, 12:08
Hi guys, I have an image of size 421x595 and I want to display this image in my application at size 632x893 but I don't want the image to pixelate.

That is against the laws of physics. Upscaling a digital signal will always degrade it's quality.

ChrisW67
12th April 2015, 12:28
You are scaling each original pixel to cover 1.5 pixels (in x and y) in the target image, i.e. 2x2 adjacent pixels cover 3x3 in the target. There is no way to do this without manufacturing data for the pixels by interpolating/averaging between the originals, and you lose clarity in the process.

ayanda83
12th April 2015, 12:30
That is against the laws of physics. Upscaling a digital signal will always degrade it's quality.
Thank you for your reply. Is it not possible to render the image as a vector image, just like one would do in Photoshop to avoid pixelating? Is this not possible in Qt?

anda_skoa
12th April 2015, 13:04
If it is a vector graphics then this is of course possible.

You didn't give any hint that it is, image without any additional information is usually understood to mean raster graphics.

Cheers,
_

wysota
12th April 2015, 13:23
Thank you for your reply. Is it not possible to render the image as a vector image, just like one would do in Photoshop to avoid pixelating? Is this not possible in Qt?

Vector graphics usually don't have dimensions set in pixels. You have given us information about size of the image therefore I'm guessing the image is a bitmap. If so, upscaling it in Photoshop or anywhere else will give identical results - an interpolated jagged aliased raster. You really cannot cheat physics.