Results 1 to 4 of 4

Thread: Is there a better way to load a big image?

  1. #1
    Join Date
    Sep 2008
    Posts
    93
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default Is there a better way to load a big image?

    I hope to load a big image, for example 10MP with the QImage. But it is too slow, is there a better way to speed up the loading process?

    Thanks

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

    Default Re: Is there a better way to load a big image?

    If the image takes 10MB compressed (I take it that this is the case) then it has to take time to load and to uncompress itself. There is no way to avoid it. What you can do is compose the image from smaller images. Qt doesn't support progressive loading as it could also be a kind of a solution for you. What you can do is to load the image in another thread so that your application remains responsive while the image is being opened.

  3. The following user says thank you to wysota for this useful post:

    learning_qt (26th November 2008)

  4. #3
    Join Date
    Sep 2008
    Posts
    93
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default Re: Is there a better way to load a big image?

    How can we compose the big image from small images? Or can we cut a big image to small images?

  5. #4
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Thanks
    40
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Is there a better way to load a big image?

    QImage QImage::copy ( const QRect & rectangle = QRect() ) const

    Returns a sub-area of the image as a new image.
    The returned image is copied from the position (rectangle.x(), rectangle.y()) in this image, and will always have the size of the given rectangle.
    In areas beyond this image, pixels are set to 0. For 32-bit RGB images, this means black; for 32-bit ARGB images, this means transparent black; for 8-bit images, this means the color with index 0 in the color table which can be anything; for 1-bit images, this means Qt::color0.
    If the given rectangle is a null rectangle the entire image is copied.
    See also QImage().
    Once loaded you can cut the image to smaller parts.
    Last edited by jacek; 26th November 2008 at 18:15. Reason: changed [code] to [quote]
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

Similar Threads

  1. [Qt4] How to load Url image into QImage?
    By Gonzalez in forum Qt Programming
    Replies: 6
    Last Post: 13th October 2014, 10:10
  2. can Qlabel display a series of image one by one ?
    By jirach_gag in forum Qt Tools
    Replies: 3
    Last Post: 11th August 2008, 15:36
  3. best way to load image from db
    By C167 in forum Qt Programming
    Replies: 2
    Last Post: 10th April 2008, 18:24
  4. how to load a Qt non-supported Image format
    By Nithya in forum Qt Programming
    Replies: 5
    Last Post: 3rd April 2008, 12:57
  5. Finding marks on scanned image for alignment
    By caduel in forum Qt Programming
    Replies: 1
    Last Post: 23rd September 2007, 02:10

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.