Displaying a big pixmap or image does not work. How can this be fixed?

The windowing systems have some limitations in regards to the size of pixmaps that they are capable of rendering. The actual size of an image that is supported varies from machine to machine and depends on OS, graphics hardware, memory and other running applications. In general we recommend that one does not create pixmaps that are significantly larger than your screen. When you load a QImage [doc.qt.nokia.com] and you want to draw this, it is implicitly converted to a pixmap so you are subject to this limitation.

To work around this, then if it is possible in your case, you can make your image smaller and load that one. If this is not an option, then you can split your big image into smaller chunks, say 1000 by 1000 pixels and draw the big image as adjacent parts of the big image.

1 comment

December 5, 2010

Picture of xsacha xsacha

Ant Farmer

On Symbian it is important to modify your EPOCHEAPSIZE. If the image is too big, it won’t be able to load otherwise.
Example:

  1. TARGET.EPOCHEAPSIZE = 0x3000 0x1000000

To avoid the program from reading in the entire file and to make the image loading much faster, you can use this method:

  1. QImageReader newImageReader;
  2. newImageReader.setFileName(fileName);
  3. newImageReader.setScaledSize(QSize(550, 550));
  4. QImage newImage;
  5. newImageReader.read(&newImage);

It will only read for 550×550 so you don’t have to worry about a spike in memory before the pixels are discarded.

Write a comment

Sorry, you must be logged in to post a comment.