bugpyFormex - Bugs: bug #36995, save PNG image add transparency...


bug #36995: save PNG image add transparency when resolution is decided by user

Submitter:  gianluca de santis <gianlucadesi>
Submitted:  Mon 30 Jul 2012 09:33:15 AM UTC
Category:  GUI Severity:  3 - Normal
Item Group:  Functionality error Status:  In Progress
Privacy:  Public Assigned to:  bverheg
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup

Sun 26 May 2013 05:45:39 PM UTC, comment #5: 

There is a problem remaining with the saving of images at a size different from the actual canvas. If a transparent rendering contains opaque objects, the opaque do no come out on top.

I attach two images illustrating the problem:
- image_size_1_r.png was saved with the actual canvas size
- image_size_2_r.png was saved with the double size and then reduced to the original size using imagemagick

The blue object is opaque but is seen transparent in the second image.

Benedict Verhegghe <bverheg>
Group administrator
Fri 24 May 2013 05:18:44 PM UTC, comment #4: 

This has been fixed in commit 59b1a03, with a workaround.

The problem was indeed the alpha channel, which is why formats
without transparency were saved correctly.

The alpha channel is now removed via a conversion to numpy array
and back. If someone knows how to do this directly on the QImage, please let me know.

Benedict Verhegghe <bverheg>
Group administrator
Wed 22 May 2013 03:08:27 PM UTC, comment #3: 

The same problem occurs with saving in 'TIFF' format.
The formats BMP, JPEG (JPG), PPM, XPM do not have the problem.
So, save in one of these formats (preferable XPM: it is the smallest non-compressed format) and then convert to PNG/TIF:

convert myimage.xpm myimage.png

Benedict Verhegghe <bverheg>
Group administrator
Tue 21 May 2013 06:50:15 PM UTC, comment #2: 

Saving an image from onscreen rendering does not work if the requested size is larger than the current viewport. Therefore I have reactivated the virtual rendering for saving images. Selectable via the configuration variable gui/image_virtual. Default is True.

(commit a834d81)

Benedict Verhegghe <bverheg>
Group administrator
Tue 26 Feb 2013 07:14:47 PM UTC, comment #1: 

Using offscreen rendering does not work properly (sometimes ok, sometimes transparent) and also has the effect that the image is
not properly rescaled, so you miss some parts if you resize to another aspect ratio.

Therefore I reverted this to using the onscreen rendering engine, using an explicit canvas resize (and back).
(commit c8b2275)

We may later give offscreen rendering a new try in the new opengl engine.

Benedict Verhegghe <bverheg>
Group administrator
Mon 30 Jul 2012 09:33:15 AM UTC, original submission:  

When saving a PNG image, if the user specify a resolution that is different from the viewport resolution, the object is drawn as a transparent object.

gianluca de santis <gianlucadesi>
Group Member


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #28179:  image_size_1_r.png added by bverheg (28KiB - image/png)
file #28180:  image_size_2_r.png added by bverheg (52KiB - image/png)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by bverheg (Posted a comment)
  • -email is unavailable- added by gianlucadesi (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-11-07 bverheg StatusFixed In Progress
    2013-05-26 bverheg Attached File- Added image_size_1_r.png, #28179
        Attached File- Added image_size_2_r.png, #28180
    2013-05-24 bverheg Open/ClosedClosed Open
    2013-02-26 bverheg Severity2 - Minor 3 - Normal
        Item GroupNone Functionality error
        StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code