Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Feb 2011

    QImageReader gives incorrect image size with JPEGs

    In my code I have to download images from internet -these images may have any size or format- and then I have to scale them and cut them properly. I'm using QImageReader to do it but in Harmattan when I'm calling the method QImageReader::size() it's giving always -1 as width and height when the image is a jpg -when the format is png the size is correct-.

    The code is something like this:

    void myClass::replyFinished(QNetworkReply *reply){
        QImageReader *imgReader;
        imgReader = new QImageReader(reply);
        if((imgReader->size().width() >= ...
    The weird part is that when I scale the image to a given size, even if the original size was supposedly -1x-1 I can see the image. The problem is that without knowing the original size I cannot keep the correct aspect ratio. This is happening in the simulator and as I haven't a N9/N950 to test it myself I cannot assure it's really a bug. The same code is working in other platforms like Symbian, Windows, Mac or Meego -for netbooks-.
    Last edited by Sheenmue; 2011-11-04 at 12:11.

  2. #2
    Super Contributor
    Join Date
    Mar 2009

    Re: QImageReader gives incorrect image size with JPEGs

    Since size is not correct only for JPGs I suspect the problem is in libjpg.
    This is a bug which should be reported to JIRA ( http://bugreports.qt.nokia.com)
    BTW you could workaround this by using QImage/QPixmap API.

  3. #3
    Registered User
    Join Date
    Feb 2011

    Re: QImageReader gives incorrect image size with JPEGs

    I'll try that. In fact, that was the way I made it originally when I developed the app for Symbian but prescaling the image with QImageReader before saving it into a QPixmap was a big impact on performance -this is made while the app is running at 60fps-, although perhaps with the N9 CPU it's not such a big deal.

Similar Threads

  1. Incorrect size using CImageDecoder
    By er_benji in forum Symbian Media (Closed)
    Replies: 7
    Last Post: 2009-10-23, 04:07
  2. Jar size and Heapsize incorrect for 1680 classic
    By d_wasser in forum Feedback - Nokia Developer Services & Infrastructure
    Replies: 5
    Last Post: 2008-08-13, 10:24
  3. why can't JPEGs be drawn directly
    By dotcdotc in forum Symbian Media (Closed)
    Replies: 13
    Last Post: 2005-10-13, 03:41
  4. Number Control reacts to NaviKey in incorrect way (incorrect for me)
    By doctordwarf in forum Symbian User Interface
    Replies: 3
    Last Post: 2004-02-04, 10:59

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts