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. Exporting QGraphicsScene to transparent PNG?
Qt 6.11 is out! See what's new in the release blog

Exporting QGraphicsScene to transparent PNG?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.6k 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.
  • P Offline
    P Offline
    patrickkidd
    wrote on last edited by
    #1

    Is there a way to export a QGraphicsScene to a transparent PNG, where the QGraphicsItems are painted over the transparent background? Using QGraphicsScene::render() to a QImage created with QImage.Format_RGB32 just makes a PNG with a black background. Not so nice.

    Thanks!

    https://alaskafamilysystems.com/

    S 1 Reply Last reply
    0
    • P patrickkidd

      Is there a way to export a QGraphicsScene to a transparent PNG, where the QGraphicsItems are painted over the transparent background? Using QGraphicsScene::render() to a QImage created with QImage.Format_RGB32 just makes a PNG with a black background. Not so nice.

      Thanks!

      S Offline
      S Offline
      samdol
      wrote on last edited by
      #2

      @patrickkidd
      Before you save QImage, you can set QImage format as QImage::Format_ARGB32
      It puts transparent background instead black background.

      P 1 Reply Last reply
      1
      • S samdol

        @patrickkidd
        Before you save QImage, you can set QImage format as QImage::Format_ARGB32
        It puts transparent background instead black background.

        P Offline
        P Offline
        patrickkidd
        wrote on last edited by
        #3

        @samdol said in Exporting QGraphicsScene to transparent PNG?:

        @patrickkidd
        Before you save QImage, you can set QImage format as QImage::Format_ARGB32
        It puts transparent background instead black background.

        So it does. You know, I overlooked that and had thought I was using Format_ARGB32 but was actually not. Thanks for the second set of eyes!

        https://alaskafamilysystems.com/

        1 Reply Last reply
        0

        • Login

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