Answers for "python file to png"

0

python convert png to jpg

from PIL import Image

img = Image.open('image.png')
rgb_img = img.convert('RGB')
rgb_img.save('image.jpg')
Posted by: Guest on February-24-2021
0

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
Posted by: Guest on June-28-2021

Python Answers by Framework

Browse Popular Code Answers by Language