[Solved] How to change resolution of an image with Qt?



  • Is there a way to change the resolution of an image with Qt?
    I mean as a file.. You know like for e.g change the resolution of the image to 48x48...



  • QImage::scaled?



  • @QImage QImage::scaledToWidth ( int width, Qt::TransformationMode mode = Qt::FastTransformation ) const@

    bq.
    Returns a scaled copy of the image. The returned image is scaled to the given width using the specified transformation mode.
    This function automatically calculates the height of the image so that its aspect ratio is preserved.
    If the given width is 0 or negative, a null image is returned

    @QImage QImage::scaledToHeight ( int height, Qt::TransformationMode mode = Qt::FastTransformation ) const@

    bq.
    Returns a scaled copy of the image. The returned image is scaled to the given height using the specified transformation mode.
    This function automatically calculates the width of the image so that the ratio of the image is preserved.
    If the given height is 0 or negative, a null image is returned.



  • I would prefer SmoothTransformation for better quality.
    Thanks again! :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.