Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I generate the image by setting the resolution I want? #62

Open
tony8888lrz opened this issue May 29, 2023 · 2 comments
Open

Can I generate the image by setting the resolution I want? #62

tony8888lrz opened this issue May 29, 2023 · 2 comments

Comments

@tony8888lrz
Copy link

For example, I want to generate a image(256*256) like this, how could I achieve that?
image

@dshaw0004
Copy link
Contributor

Can you explain it little more ?

@happylie
Copy link

happylie commented Dec 3, 2023

@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"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants
@lepture @happylie @tony8888lrz @dshaw0004 and others