10
11<div align="center">
12<img src="https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/67a1d35e-c37c-41a4-0e5a-03a9ba585d00/public" width="500px"/>
13</div>
4
5<div align="center">
6<img src="https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/67a1d35e-c37c-41a4-0e5a-03a9ba585d00/public" width="700px"/>
7</div>
68 }
69
70 const { image } = await request.json();
71
72 // Check cache
73 const cacheKey = image.slice(0, 100); // Use first 100 characters of image as cache key
74 const cachedResult = cache.get(cacheKey);
75 if (cachedResult) {
77 }
78
79 // Preprocess image using sharp
80 const buffer = Buffer.from(image.split(',')[1], 'base64');
81 const processedImage = await sharp(buffer)
82 .resize(640, 480) // Resize to a standard size
83 .toFormat('jpeg')
84 .toBuffer();
85
86 // Convert processed image to base64
87 const processedBase64 = `data:image/jpeg;base64,${processedImage.toString('base64')}`;
88
89 // Use worker for TensorFlow.js computation
3This is a lightweight Blob Admin interface to view and debug your Blob data.
4
5
6
7## Installation
3View and interact with your Val Town SQLite data. It's based off Steve's excellent [SQLite Admin](https://www.val.town/v/stevekrouse/sqlite_admin?v=46) val, adding the ability to run SQLite queries directly in the interface. This new version has a revised UI and that's heavily inspired by [LibSQL Studio](https://github.com/invisal/libsql-studio) by [invisal](https://github.com/invisal). This is now more an SPA, with tables, queries and results showing up on the same page.
4
5
6
7## Install
3This is a lightweight Blob Admin interface to view and debug your Blob data.
4
5
6
7## Installation
3This is a lightweight SQLite Admin interface to view and debug your SQLite data.
4
5
6
7It's currently super limited (no pagination, editing data, data-type specific viewers), and is just a couple dozens lines of code over a couple different vals. Forks encouraged! Just comment on the val if you add any features that you want to share.
10
11<div align="center">
12<img src="https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/67a1d35e-c37c-41a4-0e5a-03a9ba585d00/public" width="500px"/>
13</div>
25
26// Converted from: https://github.com/victorqribeiro/imgToAscii/blob/ca7e181b9bb9770798ed3a0d3dfeb344c60953f2/src/imgToAscii.js
27import { createCanvas, type Image, loadImage } from 'https://deno.land/x/canvas@v1.4.2/mod.ts';
28import { Chalk, type Options as ChalkOptions } from 'npm:chalk';
29
30export async function imageToAnsi(
31 src: string | Image,
32 opts?: Partial<
33 {
57 }
58
59 const image = typeof src === 'string'
60 ? await loadImage(src)
61 : src;
62
63 const originalWidth = image.width();
64 const scale = maxWidth ? maxWidth / originalWidth : 1;
65
66 const height = Math.floor(image.height() * scale * scaleHeight);
67 const width = Math.floor(originalWidth * scale * scaleWidth);
68
70 const context = canvas.getContext('2d');
71
72 context.drawImage(image, 0, 0, canvas.width, canvas.height);
73 const imageData = context.getImageData(0, 0, canvas.width, canvas.height);
74
75 let string = '';
76
77 const grayStep = Math.ceil(255 / alphabet[charType].length);
78 for (let i = 0; i < imageData.data.length; i += 4) {
79 let r = imageData.data[i];
80 let g = imageData.data[i + 1];
81 let b = imageData.data[i + 2];
82
83 for (let j = 0; j < alphabet[charType].length; j++) {
3View and interact with your Val Town SQLite data. It's based off Steve's excellent [SQLite Admin](https://www.val.town/v/stevekrouse/sqlite_admin?v=46) val, adding the ability to run SQLite queries directly in the interface. This new version has a revised UI and that's heavily inspired by [LibSQL Studio](https://github.com/invisal/libsql-studio) by [invisal](https://github.com/invisal). This is now more an SPA, with tables, queries and results showing up on the same page.
4
5
6
7## Install