Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/?q=image&page=536&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=image

Returns an array of strings in format "username" or "username/projectName"

Found 6288 results for "image"(618ms)

multiplayerCirclesREADME.md1 match

@peterqliu•Updated 7 months ago
3Move circles around. State is synced with the server. Open a window in another tab and watch the circles update as you move them .
4
5![image.png](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/e2a6db10-906d-4398-6e13-32475a0b6500/public)
6

slamBotPostmain.tsx39 matches

@dupontgu•Updated 7 months ago
1import { createCanvas, loadImage } from "https://deno.land/x/canvas/mod.ts";
2import { blob } from "https://esm.town/v/std/blob";
3import { BLOB_PREFIX, POST_PREFIX, Slam } from "https://esm.town/v/dupontgu/findSlamArticles";
4import { Counter } from "https://esm.town/v/dupontgu/persistentCounter"
5import { blueskyPostWithImage } from "https://esm.town/v/dupontgu/heavenlyOrangeMarmoset"
6
7// Replace with your actual access token and Mastodon instance URL
9const MASTODON_URL = "https://mastodon.social";
10
11interface Image {
12 url: string
13 // text locations within image, Vec3: [x, y, rotation]
14 slammer_txt_loc: number[]
15 slammed_txt_loc: number[],
17 alt_txt: string
18}
19const images: Image[] = [
20 {
21 url:"https://bloximages.newyork1.vip.townnews.com/gazette.com/content/tncms/assets/v3/editorial/d/ea/dea0914b-9915-553c-bc42-81313201d4ac/5b32bb43c0f7e.image.jpg",
22 slammer_txt_loc: [140, 190, -0.4],
23 slammed_txt_loc: [90, 280, -0.0],
40 },
41 {
42 url:"https://media.licdn.com/dms/image/v2/C4E12AQGcr20PW6r-Sw/article-cover_image-shrink_423_752/article-cover_image-shrink_423_752/0/1520115254001?e=1733356800&v=beta&t=OVWwDx4QhdF1IaMjSOOMpLRGRCnSVGp7Il_mERmKBGc",
43 slammer_txt_loc: [180, 120, -0.0],
44 slammed_txt_loc: [280, 330, -0.0],
61 },
62 {
63 url:"https://i.dailymail.co.uk/1s/2024/03/19/04/82623845-13212905-image-a-89_1710821176313.jpg",
64 slammer_txt_loc: [310, 440, -0.0],
65 slammed_txt_loc: [170, 790, -0.0],
82 },
83 {
84 url:"https://static.wikia.nocookie.net/international-pokedex/images/6/6a/Body_Slam_%28Ash%27s_Snorlax%29.png",
85 slammer_txt_loc: [280, 100, -0.0],
86 slammed_txt_loc: [240, 430, -0.0],
96 },
97 {
98 url:"https://static.wikia.nocookie.net/baki/images/2/22/Tackle.png/revision/latest?cb=20170117232328",
99 slammer_txt_loc: [150, 100, -0.0],
100 slammed_txt_loc: [510, 350, -0.0],
110 },
111 {
112 url:"https://static.wikia.nocookie.net/dragonball/images/2/2b/Gigantic_Spike.png/revision/latest/scale-to-width-down/1000?cb=20180515222853",
113 slammer_txt_loc: [270, 100, -0.0],
114 slammed_txt_loc: [340, 500, -0.0],
125]
126
127async function uploadImage(imageBuffer: any, altText: string): Promise<string> {
128 const formData = new FormData();
129 formData.append("file", new Blob([imageBuffer], { type: "image/png" }));
130 formData.append("description", altText);
131
139
140 if (!uploadResponse.ok) {
141 throw new Error("Failed to upload image");
142 }
143
146}
147
148async function postStatusWithImage(statusText: string, imageBuffer: any, altText: string) {
149 const mediaId = await uploadImage(imageBuffer, altText);
150
151 const postResponse = await fetch(`${MASTODON_URL}/api/v1/statuses`, {
157 body: JSON.stringify({
158 status: statusText,
159 media_ids: [mediaId], // Attach the uploaded image by its media ID
160 }),
161 });
170}
171
172async function overlayTextOnImage(slammer_text: string, slammed_text: string, imageDef: Image): Promise<Uint8Array> {
173 const image = await loadImage(imageDef.url);
174 let fontFile = await fetch(
175 "https://github.com/sophilabs/macgifer/raw/master/static/font/impact.ttf",
177 const fontBlob = await fontFile.blob();
178 let fontBytes = new Uint8Array(await fontBlob.arrayBuffer());
179 const canvas = createCanvas(image.width(), image.height());
180 canvas.loadFont(fontBytes, { family: "Impact" });
181 const ctx = canvas.getContext('2d');
182
183 ctx.drawImage(image, 0, 0, image.width(), image.height());
184 ctx.fillStyle = 'white';
185 ctx.strokeStyle = 'black';
189
190 const baseTextSize = 46;
191 const slammer_size = (baseTextSize * imageDef.text_scale) - (slammer_text.length * imageDef.text_scale * 0.84)
192 ctx.font = `${slammer_size}px Impact`;
193 ctx.rotate(imageDef.slammer_txt_loc[2])
194 let xAdjust = (slammer_text.length / 2) * 6
195 ctx.strokeText(slammer_text, imageDef.slammer_txt_loc[0] - xAdjust, imageDef.slammer_txt_loc[1]);
196 ctx.fillText(slammer_text, imageDef.slammer_txt_loc[0] - xAdjust, imageDef.slammer_txt_loc[1]);
197
198 // reset rotation
199 ctx.rotate(-imageDef.slammer_txt_loc[2])
200 const slammed_size = (baseTextSize * imageDef.text_scale) - (slammed_text.length * imageDef.text_scale * 0.84)
201 ctx.font = `${slammed_size}px Impact`;
202 ctx.rotate(imageDef.slammed_txt_loc[2])
203 xAdjust = (slammed_text.length / 2) * 6
204 ctx.strokeText(slammed_text, imageDef.slammed_txt_loc[0] - xAdjust, imageDef.slammed_txt_loc[1]);
205 ctx.fillText(slammed_text, imageDef.slammed_txt_loc[0] - xAdjust, imageDef.slammed_txt_loc[1]);
206
207 return canvas.toBuffer('image/png');
208}
209
216 const postCounter = new Counter("SLAM_post_counter");
217 const count = await postCounter.get()
218 const image = images[count % images.length]
219 // const image = images[images.length - 1]
220 const modifiedImageBuffer = await overlayTextOnImage(slam.slammer, slam.slammed, image);
221 const adjustedHeadline = slam.txt.replace('slams', 'SLAMS').replace('Slams', 'SLAMS')
222 const statusText = `${adjustedHeadline}\n\n via \n${slam.url}`
223 const altText = `${image.alt_txt}\n The slammer is labeled with ${slam.slammer} and the person or thing being slammed is labeled ${slam.slammed}.\n\n image source: ${image.url}`
224 const mastoUrl = await postStatusWithImage(statusText, modifiedImageBuffer, altText)
225 await blob.delete(inputs[0].key)
226 await blob.setJSON(POST_PREFIX + slam.url, {url:mastoUrl})
227 await postCounter.increment()
228 await blueskyPostWithImage(statusText, modifiedImageBuffer, altText)
229 return new Response(modifiedImageBuffer, {
230 headers: {
231 'Content-Type': 'image/png',
232 },
233 });

heavenlyOrangeMarmosetmain.tsx5 matches

@dupontgu•Updated 7 months ago
1import { BskyAgent, BlobRef, RichText } from 'npm:@atproto/api';
2
3export async function blueskyPostWithImage(statusText: string, imageBuffer: any, altText: string) {
4 const BSKY_EMAIL = Deno.env.get("BSKY_EMAIL");
5 const BSKY_PWD = Deno.env.get("BSKY_PWD");
8 const rt = new RichText({ text: statusText })
9 await rt.detectFacets(agent)
10 const { data } = await agent.uploadBlob(imageBuffer, { encoding: "png" })
11 const postReuslt = await agent.post({
12 text: rt.text,
13 facets: rt.facets,
14 embed: {
15 $type: 'app.bsky.embed.images',
16 images: [
17 {
18 image: data.blob,
19 alt: altText
20 }

uptimeREADME.md1 match

@vyatka•Updated 7 months ago
10
11<div align="center">
12<img src="https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/67a1d35e-c37c-41a4-0e5a-03a9ba585d00/public" width="500px"/>
13</div>

blob_adminREADME.md1 match

@thesolarmonk•Updated 7 months ago
3This is a lightweight Blob Admin interface to view and debug your Blob data.
4
5![b7321ca2cd80899250589b9aa08bc3cae9c7cea276282561194e7fc537259b46.png](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/311a81bb-18d8-4583-b7e3-64bac326f700/public)
6
7Use this button to install the val:

blob_adminREADME.md1 match

@akilangh•Updated 7 months ago
3This is a lightweight Blob Admin interface to view and debug your Blob data.
4
5![b7321ca2cd80899250589b9aa08bc3cae9c7cea276282561194e7fc537259b46.png](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/311a81bb-18d8-4583-b7e3-64bac326f700/public)
6
7Use this button to install the val:

twitterRecentMentionsmain.tsx1 match

@charmaine•Updated 7 months ago
32 username: tweet.user.screen_name,
33 name: tweet.user.name,
34 profile_image: tweet.user.profile_image_url_https,
35 media: tweet.entities?.media?.[0]?.media_url_https,
36 }));

socialDataUpdatemain.tsx3 matches

@charmaine•Updated 7 months ago
1// This val fetches recent tweets about @SnapAR or Lens Studio, removes duplicates,
2// and displays them as embedded tweets with preview images on a dark background.
3// Updated to use Social Data instead of Twitter API
4
6
7// This val fetches recent social media posts about @SnapAR or Lens Studio using socialDataSearch,
8// and displays them as embedded posts with preview images on a dark background.
9
10export default async function server(request: Request): Promise<Response> {
35 username: tweet.user.screen_name,
36 name: tweet.user.name,
37 profile_image: tweet.user.profile_image_url_https,
38 media: tweet.entities?.media?.[0]?.media_url_https,
39 }));

blob_adminREADME.md1 match

@calintamas•Updated 7 months ago
3This is a lightweight Blob Admin interface to view and debug your Blob data.
4
5![b7321ca2cd80899250589b9aa08bc3cae9c7cea276282561194e7fc537259b46.png](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/311a81bb-18d8-4583-b7e3-64bac326f700/public)
6
7Use this button to install the val:

sqliteExplorerAppREADME.md1 match

@molefrog•Updated 7 months ago
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![image.webp](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/c8e102fd-39ca-4bfb-372a-8d36daf43900/public)
6
7## Install

brainrot_image_gen1 file match

@dcm31•Updated 1 week ago
Generate images for Italian Brainrot characters using FAL AI

modifyImage2 file matches

@stevekrouse•Updated 1 week ago
Chrimage
Atiq
"Focal Lens with Atig Wazir" "Welcome to my photography journey! I'm Atiq Wazir, a passionate photographer capturing life's beauty one frame at a time. Explore my gallery for stunning images, behind-the-scenes stories, and tips & tricks to enhance your own