captcha
captcha copied to clipboard
Can I generate the image by setting the resolution I want?
For example, I want to generate a image(256*256) like this, how could I achieve that?
Can you explain it little more ?
@tony8888lrz Maybe... If you adjust the width/height, you can do it at the desired value You can also look at the code here for more information.
width = 256
height = 256
font_sizes: tuple = (50, 58, 64)
image = ImageCaptcha(width, height, font_sizes=font_sizes)
captcha_text = '12g3r28ty324h32'
id = image.generate(captcha_text)
print("data:image/png;base64," + base64.b64encode(io.BytesIO(id.read()).getvalue()).decode(
"utf-8"))