Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Python create a new png file

from pil import Image

def newImg():
    img = Image.new('RGB', (100, 100))
    img.putpixel((30, 60), (155, 155, 55))
    img.save(r'C:UserslenovoDesktopsqr.png')

    return img

newImg()
Comment

python how to make a png

import png
s = ['110010010011',
     '101011010100',
     '110010110101',
     '100010010011']
s = [[int(c) for c in row] for row in s]

w = png.Writer(len(s[0]), len(s), greyscale=True, bitdepth=1)
f = open('png.png', 'wb')
w.write(f, s)
f.close()

# https://pypng.readthedocs.io/en/latest/ex.html
Comment

PREVIOUS NEXT
Code Example
Python :: python xmlrpc 
Python :: alternative to time.sleep() in python 
Python :: 2nd to last index python 
Python :: random.randint(0,20) + pyrthon 
Python :: python int to byte 
Python :: for in loop python 
Python :: python count how many times a word appears in a string 
Python :: lower and upper case user input python 
Python :: crypto trading bot python 
Python :: add title to tkinter window python 
Python :: how to unimport a file python 
Python :: Best Python Free Tutorial 
Python :: escape brackets in regex python 
Python :: pyqt math 
Python :: convert 2 lists into dictionary 
Python :: feature engineering data preprocessing 
Python :: what is the size of cover in facebook 
Python :: how to print random in python 
Python :: opening a file in python 
Python :: cv2 assertion failed 
Python :: import from parent directory python 
Python :: add vertical line in plot python 
Python :: Async-Sync 
Python :: why is c++ faster than python 
Python :: discord bot python get message id 
Python :: docker remote 
Python :: Removing Elements from Python Dictionary Using popitem() method 
Python :: flask form options 
Python :: onehot encode list of columns pandas 
Python :: change the format of date in python 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =