Results 1 to 8 of 8

Thread: QImage() returns Null Image

  1. #1
    Join Date
    Jun 2012
    Posts
    58
    Thanks
    13
    Qt products
    Qt4

    Default QImage() returns Null Image

    hi,
    I am using Visual Studio 2010 with qt 3rd party libraries which belong to 4.7.0.0 (version as mentioned in the .dll files). I'm doing the following:
    Qt Code:
    1. QImage image(QString(qstrSomeValidFilePathToJpeg));
    2. qDebug() << "NULL?" << image.isNull();
    To copy to clipboard, switch view to plain text mode 
    This always returned "true". So i compiled the same line using installed QtSDK and it returned "false", which meant it successfully read the jpeg file. After some analysis i realized that the problem was with the 3rd party qt libraries. QGuid4.dll was of version 4.7.0.0. I replaced this (and others since you must have all .dll's of the same version else it gives errors like "entry point not found...") with the SDK's 4.8.1.0 and the code compiled with visual studio worked fine too (returned "false"). But i'm required to use only 4.7.0 libraries.

    <1> why this behaviour? what is lacking in 4.7.0.0 dll's (i need only gui,core and network dll's at the moment)?
    <2> how should i proceed if i'm restricted to use only 4.7.0.0?

  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: QImage() returns Null Image

    It's likely you are missing an image plugin.

    http://www.qtcentre.org/faq.php?faq=...missing_images

    A possible solution is to use a png image instead of jpeg.
    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
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QImage() returns Null Image

    did you also include dlls from /imageformats ?
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  4. #4
    Join Date
    Jun 2012
    Posts
    58
    Thanks
    13
    Qt products
    Qt4

    Default Re: QImage() returns Null Image

    @wysota: yes i thought so. so you mean the functionality of plugins has been moved into QtGuid4.dll for 4.8.1? also PNG is not an option. I'm working on building a protocol the client of which that can ask an image in various formats. I have to support atleast jpeg,png and rgb8

    @amleto: yes i did that too but it didn't work. maybe qjpegd4.dll i am using is of 4.7.4 while 3rd party libraries are of 4..7.0.0. Could this cause a problem? i cant find plugin dll's of version 4.7.0.0.

  5. #5
    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: QImage() returns Null Image

    Quote Originally Posted by ustulation View Post
    @wysota: yes i thought so. so you mean the functionality of plugins has been moved into QtGuid4.dll for 4.8.1?
    No I mean for 4.8.1 you have the plugin and for 4.7.0 you don't have it.

    also PNG is not an option. I'm working on building a protocol the client of which that can ask an image in various formats. I have to support atleast jpeg,png and rgb8
    You need the image plugin then.
    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
    Jun 2012
    Posts
    58
    Thanks
    13
    Qt products
    Qt4

    Default Re: QImage() returns Null Image

    ah..but why is it that if i replace QtGui4/QtGuid4 .dll's of version 4.7.0 with 4.8.1 in the repository, then it works without any problem. There is no plugin in the cvs online repository.
    Secondly when i asked the project owner to allow 4.8.1 dll's he's concerned that it could cause breakage of existing codes that use the 3rd party libraries. Do you know of any functionality of 4.7.0 which has been made obsolete in 4.8.1? (deprecated ones dont cause a problem i think..just that their use is discouraged)

  7. #7
    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: QImage() returns Null Image

    Quote Originally Posted by ustulation View Post
    ah..but why is it that if i replace QtGui4/QtGuid4 .dll's of version 4.7.0 with 4.8.1 in the repository, then it works without any problem. There is no plugin in the cvs online repository.
    If you can load jpegs then either you have the plugin or you built the plugin functionality into the library when building the library by passing an appropriate switch to configure.exe.

    Secondly when i asked the project owner to allow 4.8.1 dll's he's concerned that it could cause breakage of existing codes that use the 3rd party libraries. Do you know of any functionality of 4.7.0 which has been made obsolete in 4.8.1? (deprecated ones dont cause a problem i think..just that their use is discouraged)
    The problem is not about functionality becoming obsolete as code is not removed from Qt libs. However some code might break because of using some flaw or undocumented feature in 4.7.0 that might have been fixed in some later version of the library. The best solution is to ask the maintainer to provide image plugins for 4.7.0 or to provide a version of Qt libs with image loading code embedded into the library itself.
    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.


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

    ustulation (24th July 2012)

  9. #8
    Join Date
    Jun 2012
    Posts
    58
    Thanks
    13
    Qt products
    Qt4

    Default Re: QImage() returns Null Image

    thanks! i'll do that.

Similar Threads

  1. QImage: out of memory, returning null image
    By singhzubin in forum Qt Quick
    Replies: 1
    Last Post: 10th December 2010, 08:08
  2. Replies: 33
    Last Post: 2nd December 2010, 16:47
  3. QImage->save(); returns 0
    By ramzes13 in forum Newbie
    Replies: 2
    Last Post: 22nd September 2010, 14:49
  4. QDBusMessage returns NULL string
    By nrabara in forum Qt Programming
    Replies: 0
    Last Post: 27th November 2009, 06:09
  5. Replies: 3
    Last Post: 15th March 2006, 11:44

Tags for this Thread

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.