maxm-asciiimageexample.web.val.run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { imageToAscii } from "https://esm.town/v/maxm/imageToAscii";
export default async function(req: Request): Promise<Response> {
const { string, stringColor } = await imageToAscii(
"https://webcams.nyctmc.org/api/cameras/9fa5b0dd-e955-449e-97e1-9c53ad9c23a8/image",
150,
);
return new Response(
`
<style>
pre {
font-family: Courier, monospace;
line-height: 6px;
font-size: 6px;
display: inline-block;
font-weight: 800;
line-height: 4px;
font-size: 8px;
letter-spacing: -2px;
}
</style>
<pre>${stringColor}</pre>`,
{ headers: { "Content-Type": "text/html" } },
);
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
v17
June 10, 2024