Results 1 to 7 of 7

Thread: Maximum PNG dimensions?

  1. #1
    Join Date
    Nov 2010
    Posts
    77
    Thanks
    17
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Maximum PNG dimensions?

    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?

  2. #2
    Join Date
    Jan 2008
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: Maximum PNG dimensions?

    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 ?

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Maximum PNG dimensions?

    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.

  4. #4
    Join Date
    Nov 2010
    Posts
    77
    Thanks
    17
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Maximum PNG dimensions?

    Quote Originally Posted by ChrisW67 View Post
    Typically this image buffer would need to allocated in a contiguous block which could be difficult.
    Does this fail without a warning? My export instructions execute fine in all cases, but if the image is too big no file is written. Is there a proper way to check if the export failed or do I just check if the file exists on the disk?

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Maximum PNG dimensions?

    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.

  6. The following user says thank you to ChrisW67 for this useful post:

    blooglet (5th May 2011)

  7. #6
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Maximum PNG dimensions?

    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!!!

  8. #7
    Join Date
    Nov 2010
    Posts
    77
    Thanks
    17
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Maximum PNG dimensions?

    Quote Originally Posted by ChrisW67 View Post
    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.
    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!

Similar Threads

  1. Phonon - how to retrieve video dimensions ?
    By liversedge in forum Qt Programming
    Replies: 0
    Last Post: 10th October 2010, 22:47
  2. Arrays & Vectors Dimensions
    By lixo1 in forum Qt Programming
    Replies: 5
    Last Post: 19th February 2009, 18:55
  3. Resizing screen dimensions using backbuffer in QT?
    By JimDaniel in forum Qt Programming
    Replies: 1
    Last Post: 24th September 2007, 23:13
  4. Calculate QListView content dimensions
    By Mookie in forum Qt Programming
    Replies: 3
    Last Post: 9th June 2007, 18:18
  5. 3 Dimensions using opengl
    By vermarajeev in forum Qt Programming
    Replies: 30
    Last Post: 23rd April 2007, 11:31

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.