Results 1 to 6 of 6

Thread: How do I scale an image without it pixelating?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2012
    Posts
    201
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default How do I scale an image without it pixelating?

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How do I scale an image without it pixelating?

    Quote Originally Posted by ayanda83 View Post
    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jul 2012
    Posts
    201
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How do I scale an image without it pixelating?

    Quote Originally Posted by wysota View Post
    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?

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How do I scale an image without it pixelating?

    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,
    _

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How do I scale an image without it pixelating?

    Quote Originally Posted by ayanda83 View Post
    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How do I scale an image without it pixelating?

    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.

Similar Threads

  1. Replies: 2
    Last Post: 30th December 2011, 05:44
  2. Replies: 1
    Last Post: 23rd April 2011, 00:36
  3. Scale Image centered
    By metRo_ in forum Qt Programming
    Replies: 2
    Last Post: 23rd August 2010, 20:25
  4. Scale an image and assign it to a QPushButton
    By harmodrew in forum Newbie
    Replies: 2
    Last Post: 10th August 2010, 11:46
  5. how to scale a picture/image?
    By savaliya_ambani in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 26th May 2010, 12:51

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.