Results 1 to 2 of 2

Thread: how to scale image?

  1. #1
    Join Date
    Apr 2016
    Posts
    37
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Windows

    Exclamation how to scale image?

    I am currently doing imageViewer.

    I have a problem , when i scale a image , i find QImage::scale so slow.

    this leads UI thread block.

    my image file size is 3MB and size is 8900*8105.

    Do you have any good Suggestions?

    thanks.

    Qt Code:
    1. QTime time;
    2. time.start();
    3. QImage image(imagePath);
    4. qDebug()<<"load image time elapsed is : "<<time.elapsed();//load image time elapsed is : 4407
    5. image.scaled(image.width() * 0.09 , image.height() * 0.09 , Qt::KeepAspectRatio , Qt::SmoothTransformation);
    6. qDebug()<<"scaled image time elapsed is : "<<time.elapsed();//scaled image time elapsed is : 5231
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to scale image?

    Yu can use QtConcurrent to move the calculation to a different thread. See https://doc.qt.io/qt-5.10/qtconcurrentrun.html - there is an example on how to modify a QImage

Similar Threads

  1. How do I scale an image without it pixelating?
    By ayanda83 in forum Qt Programming
    Replies: 5
    Last Post: 12th April 2015, 13:23
  2. Replies: 2
    Last Post: 30th December 2011, 06:44
  3. Scale Image centered
    By metRo_ in forum Qt Programming
    Replies: 2
    Last Post: 23rd August 2010, 21:25
  4. Scale an image and assign it to a QPushButton
    By harmodrew in forum Newbie
    Replies: 2
    Last Post: 10th August 2010, 12: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, 13: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.