Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QImage and QPıx cant read this png image but opencv does why ?
Forum Updated to NodeBB v4.3 + New Features

QImage and QPıx cant read this png image but opencv does why ?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 629 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RahibeMeryem
    wrote on last edited by
    #1

    Hi,

    I encountered a PNG image that neither :

    QPixmap qpix(fileName)
    

    nor

    QImage photo(fileName);
    

    can read . Both says invalid image.

    But I can read with and succesfully convert them to qimage and qpix with opencv with :

    cv::Mat cv_image = cv::imread(fileName.toStdString());
    

    Is there any clue why this is happening this png image. Other png images has no problem..

    PS: When I convert to image to jpg or export as png again its working.

    image is:

    http://s000.tinyupload.com/?file_id=21483901468334087956

    IMAGE

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      The mm.png is actually a jpg file.
      It just has the wrong extension.

      1 Reply Last reply
      2
      • R Offline
        R Offline
        RahibeMeryem
        wrote on last edited by
        #3

        @mrjj yes you right.. thanks a lot..

        PS: QImage and QPixmap should check the file as opencv, it is deciding by their extension I assume.

        mrjjM 1 Reply Last reply
        0
        • R RahibeMeryem

          @mrjj yes you right.. thanks a lot..

          PS: QImage and QPixmap should check the file as opencv, it is deciding by their extension I assume.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @RahibeMeryem
          Hi
          Yeah, it can do some guessing looking at the header
          but I think it only tries to guess if there is
          not extension.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved