transparency

Pygame : image.convert_alpha() won't work

Pygame : image.convert_alpha() won't work Question: So, I’m making a prototype of game using Pygame, Pytmx, and PyScroll (I’m following "Graven" Turorial on youtube) This is my problem : I have a spritesheet (96×38 pixels), and I want to get only one image of it.. class Player(pygame.sprite.Sprite): def __init__(self, x, y): super(Player, self).__init__() self.spritesheet = …

Total answers: 1

OpenCV imread transparency gone

OpenCV imread transparency gone Question: I have an image (a captcha) that I download from the web. When I loaded to opencv it seems to loose its properties or simply mixes the transparent background with the dark/black colors: Currently the code does nothing but loading a writing again: captchaImg = cv2.imread(‘captcha1.png’) cv2.imwrite("captcha2.png", captchaImg) I have …

Total answers: 2

How to make Matplotlib scatterplots transparent as a group?

How to make Matplotlib scatterplots transparent as a group? Question: I’m making some scatterplots using Matplotlib (python 3.4.0, matplotlib 1.4.3, running on Linux Mint 17). It’s easy enough to set alpha transparency for each point individually; is there any way to set them as a group, so that two overlapping points from the same group …

Total answers: 5

Setting Background color to transparent in Plotly plots

Setting Background color to transparent in Plotly plots Question: My python code creates a plotly bar plot, but the background is white in color. I want to change it into transparent color. Is that doable? My Code: import plotly.plotly as py from plotly.graph_objs import * py.sign_in(‘username’, ‘api_key’) data = Data([ Bar( x=[‘Sivaranjani S’, ‘Vijayalakshmi C’, …

Total answers: 3

Adjusting Text background transparency

Adjusting Text background transparency Question: I’m trying to put some text with a background on a matplotlib figure, with the text and background both transparent. The following code import numpy as np import matplotlib.pyplot as plt plt.figure() ax = plt.subplot(111) plt.plot(np.linspace(1,0,1000)) t = plt.text(0.03,.95,’text’,transform=ax.transAxes,backgroundcolor=’0.75′,alpha=.5) plt.show() makes the text semi-transparent relative to the text’s background, but …

Total answers: 1

Plotting with a transparent marker but non-transparent edge

Plotting with a transparent marker but non-transparent edge Question: I’m trying to make a plot in matplotlib with transparent markers which have a fixed color edge . However, I can’t seem to achieve a marker with transparent fill. I have a minimum working example here: import numpy as np import matplotlib.pyplot as plt x = …

Total answers: 2

How to export plots from matplotlib with transparent background?

How to export plots from matplotlib with transparent background? Question: I am using matplotlib to make some graphs and unfortunately I cannot export them without the white background. In other words, when I export a plot like this and position it on top of another image, the white background hides what is behind it rather …

Total answers: 3

How to CREATE a transparent gif (or png) with PIL (python-imaging)

How to CREATE a transparent gif (or png) with PIL (python-imaging) Question: Trying to create a transparent gif with PIL. So far I have this: from PIL import Image img = Image.new(‘RGBA’, (100, 100), (255, 0, 0, 0)) img.save(“test.gif”, “GIF”, transparency=0) Everything I’ve found so far refers to manipulating an existing image to adjust it’s …

Total answers: 1

How to make a surface with a transparent background in pygame

How to make a surface with a transparent background in pygame Question: Can someone give me some example code that creates a surface with a transparent background in pygame? Asked By: Paul D. Eden || Source Answers: This should do it: image = pygame.Surface([640,480], pygame.SRCALPHA, 32) image = image.convert_alpha() Make sure that the color depth …

Total answers: 3