#using css to create an image

24 messages · Page 1 of 1 (latest)

wheat talon
#

im trying to create a website, using html + css, served with flask locally, that can take in a few arguments and then display an image, but i want to be able to edit this image with css, like you can with html, is this possible?

daring plaza
#

Edit?

wheat talon
#

i want to be able to use most the functions of css to make an image, like making a website, just that it gives me an image, or bytes that i can read

daring plaza
#

Can you give an example of what you mean by editing it in HTML???

wheat talon
#

i can try

#

2 mins

#

ok so here

#

ive got some basic html like this

#

and i want to be able to download that div as an image

#

with the h1 and p and everything

#

and its going to be customizable, gonna pass in arguments with render_template in flask and then put them in the card

daring plaza
#

There's not a way to do that natively in the browser. You're gonna need to use an API or tool for it.

wheat talon
#

well actually i need it to be bytes to read it, but i assume its the same?

daring plaza
#

What kind of bytes??? Images are bytes...

wheat talon
#

🤷‍♂️ just need to be able to be able to read it, then send it via my discord bot

#

my plan was : command invokes -> send request to web server with the params i need -> webserver makes the card -> read the response in my bot -> send as a file

daring plaza
#

If you're using Python it may be simpler to just use Pillow to create the card and skip using HTML/CSS all together.

wheat talon
#

yeah i was gonna but idk how to use pil, guess i will learn

#

actually its easier to pass in args to pil

#

whats the diffrence between pil and pillow?

#

says this in the docs Pillow and PIL cannot co-exist in the same environment. Before installing Pillow, please uninstall PIL.

#

nvm

daring plaza
#

Pillow is a still maintained fork of PIL