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

(API) lockWindowSize set to true can cut some content off #200

Open
ModestasV opened this issue Mar 7, 2024 · 2 comments
Open

(API) lockWindowSize set to true can cut some content off #200

ModestasV opened this issue Mar 7, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ModestasV
Copy link

ModestasV commented Mar 7, 2024

When trying to implement the API usage, I've seen lockWindowSize trying to cut off some content. Here's an example request:

{
            "settings": {
                "themeName": "github-dark",
                "title": "Hello from API!",
                "showHeader": 0,
                "showTitle": 0,
                "showMenu": 0,
                "borderRadius": 0,
                "lockWindowSize": 1
            },
            "editors": [
                {
                    "language": "php",
                    "value":"test123"
                }
            ]
        }

This produces the following image:

image

As you can see, the 3 is gone and nowhere to be found. This can be experienced with longer strings, too:

{
            "settings": {
                "themeName": "github-dark",
                "title": "Hello from API!",
                "showHeader": 0,
                "showTitle": 0,
                "showMenu": 0,
                "borderRadius": 0,
                "lockWindowSize": 1
            },
            "editors": [
                {
                    "language": "php",
                    "value": """
                     showcode_request = requests.post("https://api.showcode.app/generate", json=payload, headers=headers, stream=True)
        if showcode_request.status_code == 200:
            with open('_temp/code.png', 'wb') as temp_file:
                showcode_request.raw.decode_content = True
                shutil.copyfileobj(showcode_request.raw, temp_file)
        carbon_image = Image.open('_temp/code.png')
        # Place the code on the image
                    """
                }
            ]
        }

This produces an image that looks like this:

image

Which is again cut off at some point.

I have tried playing with the settings, but no luck figuring it out (without manually passing width/height).

Not sure if I'm doing something wrong or this is a bug :)

@stevebauman
Copy link
Owner

Thanks for the report @ModestasV! I'll take a look at this tonight 🙏

Do your results change if you enable the header to be shown via showHeader => true?

@stevebauman stevebauman added the bug Something isn't working label Mar 18, 2024
@ModestasV
Copy link
Author

ModestasV commented Mar 19, 2024

It doesn't seem that it is showing it:

image

I have attempted to add header, title and menu :)

"settings": {
                "background": "transparent",
                "themeName": "github-dark",
                "title": "Hello from API!",
                "showHeader": 1,
                "showTitle": 1,
                "showMenu": 1,
                "borderRadius": 0,
                "padding": 30,
                "fontSize": font_size,
                "font": "JetBrains Mono",
                "lineHeight": font_size * 1.5,
                "showShadow": 0,
                "lockWindowSize": 1
            },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants