Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blank png: x.png does not set the alpha/transparency info correctly ! #848

Closed
jypeter opened this issue Oct 27, 2014 · 3 comments
Closed
Assignees
Milestone

Comments

@jypeter
Copy link
Member

jypeter commented Oct 27, 2014

I have finally understood why I was getting completely blank png images, as reported in #845 after trying to open the png in different programs: it seems that somehow the image is there, but the alpha channel value is set to 0 for all the pixels (according to gimp's color picker tool), which make the image seem completely transparent

Am I the only person having this problem ???

@doutriaux1 , could you check the properties of the saved png you generate?

When I run the following commands

import numpy as np, vcs
id100 = np.identity(100)
x = vcs.init()
x.plot(id100)
x.png('test_default_png')

I get the following completely blank/transparent image!
test_default_png
If I remove the alpha/transparency with ImageMagick (http://www.imagemagick.org/Usage/masking/#alpha_off), I get a png with the visible image I want! Of course, I'd like to have directly a png I can see :)

convert -alpha off test_default_png.png test_default_png-noalpha.png

test_default_png-noalpha

@doutriaux1
Copy link
Contributor

@jypeter we changed the default back to have a non-transparent backaground, you can control this in your version via the foloowing parameter:
x.png(bla, draw_white_background = True)
or
x.png(bla, ignore_alpha=True)

@doutriaux1 doutriaux1 added this to the 2.1 milestone Oct 27, 2014
@doutriaux1 doutriaux1 self-assigned this Oct 27, 2014
@jypeter
Copy link
Member Author

jypeter commented Oct 27, 2014

Pfff, how am I supposed to guess that, it's not even in help(x.png) :/

I have tried the 4 different combinations of draw_white_background set to True or False and ignore_alpha set to True or False and

  • I confirm I get an image with ignore_alpha=True. It has a white background, regardless of the value of draw_white_background
  • I never get an image with ignore_alpha=False, regardless of the value of draw_white_background

draw_white_background does not seem to have any effect and I have not been able to get an image on a transparent background

I'm using the 2.0.0 tag UV-CDAT

@doutriaux1
Copy link
Contributor

not in your version but in master draw_white_background works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants