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 not opening 16-bit png (AFAICT)
Forum Updated to NodeBB v4.3 + New Features

QImage not opening 16-bit png (AFAICT)

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 306 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.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by Perdrix
    #1

    In my code I have this:

    pQImage = std::make_shared<QImage>(name);	// load the file
    if (pQImage->isNull())		// If it failed ...
    {
    	ZTRACE_RUNTIME("Failed to load file into QImage");
    	pQImage.reset();
    	return false;
    }
    

    It works just fine to load 8 bit jpeg and png files but when I try to feed it a 16 bit png it triggers the isNull() logic path.

    Further to the above I now know what's wrong!

    qt.gui.imageio: QImageIOHandler: Rejecting image as it exceeds the current allocation limit of 128 megabytes

    The png file is from a fairly normal DSLR camera, with a sensor size of 5184x3888 so my arithmetic says for RGBA64 at 4*2 bytes per pixel, that is 161,243,136 bytes, so a bit over 153MB (real ones, not decimal ones). A large sensor these days is about 4 times larger than that so that's 600MB or so and there are MUCH larger ones than that. I have PNG files of 14557 x 8418 px at 16 bit depth (so about 950MB) - I think you need to raise your limit to at LEAST 1GB!

    Is there any way for me to override that limit?

    Thanks
    David

    PerdrixP 1 Reply Last reply
    0
    • PerdrixP Perdrix

      In my code I have this:

      pQImage = std::make_shared<QImage>(name);	// load the file
      if (pQImage->isNull())		// If it failed ...
      {
      	ZTRACE_RUNTIME("Failed to load file into QImage");
      	pQImage.reset();
      	return false;
      }
      

      It works just fine to load 8 bit jpeg and png files but when I try to feed it a 16 bit png it triggers the isNull() logic path.

      Further to the above I now know what's wrong!

      qt.gui.imageio: QImageIOHandler: Rejecting image as it exceeds the current allocation limit of 128 megabytes

      The png file is from a fairly normal DSLR camera, with a sensor size of 5184x3888 so my arithmetic says for RGBA64 at 4*2 bytes per pixel, that is 161,243,136 bytes, so a bit over 153MB (real ones, not decimal ones). A large sensor these days is about 4 times larger than that so that's 600MB or so and there are MUCH larger ones than that. I have PNG files of 14557 x 8418 px at 16 bit depth (so about 950MB) - I think you need to raise your limit to at LEAST 1GB!

      Is there any way for me to override that limit?

      Thanks
      David

      PerdrixP Offline
      PerdrixP Offline
      Perdrix
      wrote on last edited by
      #2

      @Perdrix Woohoo! I found QImageReader::setAllocationLimit()

      1 Reply Last reply
      1
      • PerdrixP Perdrix has marked this topic as solved on

      • Login

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