When creating a QPixmap (30000, 30000), it produces the following error: libpng warning: Image width is zero in IHDR libpng warning: Image height is zero in IHDR libpng error: Invalid IHDR data

what's wrong ?

Is it possible to do so, create a QPixmap (30000, 10000) (this works) and write to a file, and during the next iteration add another QPixmap (30000, 10000) to a file?

  • Maybe he does not have enough memory? - Qwertiy
  • Maybe there are some restrictions on the size of the image? - Anton Sazonov
  • @Qwertiy: ... and he doesn't throw an exception? - VladD
  • Although some kind of mistake should be - you order a picture of 3 and a half gigabytes in size :-) - VladD
  • only gives the error "libpng warning: Image width is zero in IHDR libpng warning: Image height is zero in IHDR libpng error: Invalid IHDR data" - Lopatin Vitaly

2 answers 2

As an option to write a wrapper that dynamically loads your QPixMap from disk, that is, to split the original image into smaller ones, to store only one piece in RAM, when accessing a specific piece of memory, load it into RAM, simply overwriting the selected memory (pieces of the same size will be ), naturally all these pieces will be stored separately. And maybe there are some DBMSs that allow storing BLOB-fields in slices.

    I propose to compile the program under x64.
    This should solve the memory limit problem.


    Simply appending to the file most likely will not work, since the graphic formats assume the presence of some kind of beginning of the file, which you will also have between the parts. However, if QPixmap itself provides the ability to add a file, then this may be appropriate.

    • does not work .... - Lopatin Vitaly