Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Get base64 PNG image out of ChatGPT
1 point by a1371 on Dec 4, 2022 | hide | past | favorite | 1 comment
I come to you HN with a curiosity. The other day I was playing with ChatGPT to make HTML code. Then I had a thought: "what if I ask ChatGPT to give me png base64 binary in an img tag?" I wanted to view it in the browser. Would it be an actual image?

So far my attempts have be futile. ChatGPT understands the idea, but what it outputs is either reduced like

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..." alt="Company logo">

Or it gets too big, which I think hits some kind of max response size limit. Putting that code in an HTML file gives a `net::ERR_INVALID_URL`.

And finally, I know what Dalle2 is, in case you were wondering.



First of all, at least text-davinci-003 is great at doing base64 in its head (see e.g. https://gist.github.com/SonOfLilit/1efe2864d3803ea792c6632ad...).

However, it's really not good at visual stuff (try asking it to draw stuff in ascii art, it doesn't really understand how things look, even things that it can give you a good description of like Homer Simpson).

However, it's much easier to ask it to draw things with code. Or just SVG.

    Write an SVG drawing of Homer Simpson

    ```
    <svg width="200" height="200">
    <rect x="0" y="0" width="200" height="200" fill="yellow"/>

    <circle cx="100" cy="50" r="25" fill="black" />
    <circle cx="50" cy="50" r="25" fill="black" />

    <rect x="50" y="70" width="100" height="20" fill="black" />
    <rect x="70" y="90" width="60" height="50" fill="red" />

    <circle cx="100" cy="130" r="10" fill="black" />
    <rect x="80" y="120" width="40" height="20" fill="black" />
    </svg>
    ```




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: