-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtransparency.py
More file actions
37 lines (26 loc) · 807 Bytes
/
transparency.py
File metadata and controls
37 lines (26 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/python2.6
# coding: utf-8
import sys
import pygame
import os.path
from pygame.locals import *
class Transparency:
def __init__(self):
pass
if __name__ == "__main__":
pygame.init()
argc = len(sys.argv)
if argc != 2:
print "Error: need 1 argument (image filename)"
sys.exit()
filename = sys.argv[1]
print "Put transparency for file", filename
if not os.path.exists(filename):
print "Error:", filename, "is not a file"
sys.exit()
window = pygame.display.set_mode((200, 200))
myimage = pygame.image.load(filename).convert()
myimage.set_colorkey((255,255,255),RLEACCEL)
filename = "result_"+filename
print "Result:", filename
pygame.image.save(myimage, filename)