Friday, November 14, 2025
HomeLanguagespgmagick| creating color backgrounds

pgmagick| creating color backgrounds

In this article we will learn how we can create a background with a solid color. We can use these backgrounds in our output image backgrounds. Also we will how to create transparent and backgrounds with color gradients. 
For eg: 
 

Here in the above image green us the background color ofneveropen logo so lets start with the code.
1. Solid Background : 
Now lets create a background with solid green color. 
Code : 
 

Python3




from pgmagick.api import Image
 
img = Image((300, 300), 'green')
img.write('green.jpg')


Output : 
 

2. Transparent Background : 
Now lets create a Transparent background. 
Code : 
 

Python3




from pgmagick.api import Image
 
img = Image((300, 300), 'transparent')
img.write('transparent.jpg')


Output : 
 

2. Gradient Background : 
Now lets create a background with some color gradient. 
Code : 
 

Python3




from pgmagick.api import Image
 
img = Image((300, 200), 'gradient:# 318749-# 0eed4c')
img.write('gradient.jpg')


Output :
 

 

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32399 POSTS0 COMMENTS
Milvus
95 POSTS0 COMMENTS
Nango Kala
6765 POSTS0 COMMENTS
Nicole Veronica
11917 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11984 POSTS0 COMMENTS
Shaida Kate Naidoo
6889 POSTS0 COMMENTS
Ted Musemwa
7142 POSTS0 COMMENTS
Thapelo Manthata
6837 POSTS0 COMMENTS
Umr Jansen
6840 POSTS0 COMMENTS