I've noticed that if I try to export a QGraphicsScene to a PNG that is over 10000x10000 in size, no PNG file is written to disk. Do PNG files have a maximum width/height?
I've noticed that if I try to export a QGraphicsScene to a PNG that is over 10000x10000 in size, no PNG file is written to disk. Do PNG files have a maximum width/height?
the width/height of a PNG file is written on 4 bytes, the problem is elsewhere. not enough memory ? the way Qt writes pictures ? something else ?
A 32-bits-per-pixel, 10000 by 10000 pixel image will require at least 400 million bytes of RAM to represent uncompressed in memory. Typically this image buffer would need to allocated in a contiguous block which could be difficult. Such an image will need to exist before it can be coded and compressed into PNG form.
None that I have found. On my Linux machine attempting to create a 100k by 100k QPixmap generates an error message to the console from the underlying X library but nonetheless returns a QPixmap with the requested size and isNull() == false.
blooglet (5th May 2011)
If you use QGraphicsScene::render() you can use the second parameter to scale the scene on Pixmap
A camel can go 14 days without drink,
I can't!!!
Good that you mention that... I found out that if I check against QImage::isNull, I can see when things go wrong. isNull() returns true whenever the image is too big for export, so now I can detect when the export fails. Thanks!
Bookmarks