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/$%7Bart_info.art.src%7D?q=image&page=545&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 6504 results for "image"(1266ms)

snugPinkHummingbirdmain.tsx2 matches

@gUpdated 6 months ago
1import { imageToAnsi } from 'https://esm.town/v/g/imageToAnsi';
2
3export default async function(req: Request): Promise<Response> {
4 const url = new URL(req.url);
5
6 const ansi = await imageToAnsi(
7 'https://maxm-imggenurl.web.val.run/colorful-picture-of-a-flower',
8 {

snugPinkHummingbirdREADME.md4 matches

@gUpdated 6 months ago
2
3
4![image.png](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/58fbd48d-2257-4e18-abc7-e0e125e09d00/public)
5
6
10```
11
12You may use query parameters to modify the generated image:
13 - `level` (`0` | `1` | `2` | `3`): Chalk terminal color option
14 - `width` (number): Maximum width of the generated image
15 - `alphabet` (`full` | `special`): characters to use
16
17Projects used:
18 - [@g.imageToAnsi](https://www.val.town/v/g/imageToAnsi) for ANSI image generation
19 - [@maxm.imggenurl](https://www.val.town/v/maxm/imggenurl) for the ai generated flower

shirtGenmain.tsx9 matches

@torlancoUpdated 6 months ago
6 id: string;
7 status: "pending" | "succeeded";
8 imageUrl?: string;
9 savedUrl?: string;
10}
11
12function ImageGenerator() {
13 const [promptSuffix, setPromptSuffix] = useState("");
14 const [generation, setGeneration] = useState<PendingGeneration | null>(null);
15 const [useProModel, setUseProModel] = useState(false);
16
17 const generateImage = async () => {
18 const fullPrompt = `a shirt with a design of ${promptSuffix}`;
19 setGeneration({
32
33 if (!response.ok) {
34 throw new Error("Failed to generate image");
35 }
36
40 id: Date.now().toString(),
41 status: "succeeded",
42 imageUrl: result.imageUrl,
43 savedUrl: result.savedUrl,
44 });
45 } catch (error) {
46 console.error("Error generating image:", error);
47 setGeneration(null);
48 }
60 placeholder="Enter your design idea"
61 />
62 <button onClick={generateImage}>Generate</button>
63 </div>
64 <div className="toggle-container">
75 <div className="result">
76 {generation?.status === "pending" && <p>Generating...</p>}
77 {generation?.status === "succeeded" && generation.imageUrl && <img src={generation.imageUrl} alt="Generated" />}
78 </div>
79 </div>
82
83function App() {
84 return <ImageGenerator />;
85}
86

val_CQqfNR6svdmain.tsx1 match

@dhvanilUpdated 6 months ago
4 // Execute the code directly and capture its result
5 const result = await (async () => {
6 const getImageData = async () => { const img = new Image(); img.src = 'https://example.com/path-to-mandelbrot-image.png'; await img.decode(); const canvas = document.createElement('canvas'); canvas.width = img.width; canvas.height = img.height; const ctx = canvas.getContext('2d'); ctx.drawImage(img, 0, 0); return ctx.getImageData(0, 0, canvas.width, canvas.height).data; }; return await getImageData();
7 })();
8

imageToAnsiREADME.md1 match

@gUpdated 6 months ago
1Migrated from folder: util/imageToAnsi

stableAzureDragonmain.tsx7 matches

@temptempUpdated 6 months ago
188// const c = async B9 => {
189// try {
190// var BB = await K("https://megacloud.tv/images/loading.png?v=0.0.9");
191// window.bytes = BB;
192// console.log("THis thing is working");
454// Bh(BW).textBaseline = BK(BT, Bl);
455// };
456// BE.wbg.__wbg_drawImage_cb13768a1bdc04bd = function() {
457// return Bg(function(BW, BT, Bl, BC) {
458// Bh(BW).drawImage(Bh(BT), Bl, BC);
459// }, arguments);
460// };
461// BE.wbg.__wbg_getImageData_66269d289f37d3c7 = function() {
462// return Bg(function(BW, BT, Bl, BC, Bj) {
463// return Bf(Bh(BW).getImageData(BT, Bl, BC, Bj));
464// }, arguments);
465// };
556// return Bf(Bh(BW).style);
557// };
558// BE.wbg.__wbg_instanceof_HtmlImageElement_9c82d4e3651a8533 = function(BW) {
559// let BT;
560// try {
561// BT = Bh(BW) instanceof HTMLImageElement;
562// } catch (Bl) {
563// BT = false;

passionateScarletPrawnmain.tsx26 matches

@stevekrouseUpdated 6 months ago
26
27 if (!response.ok) {
28 throw new Error("Failed to generate image");
29 }
30
40 return (
41 <div className="container">
42 <h1>AI Image Generator</h1>
43 <form onSubmit={handleSubmit}>
44 <textarea
45 value={prompt}
46 onChange={(e) => setPrompt(e.target.value)}
47 placeholder="Enter your image prompt here..."
48 required
49 />
58 </div>
59 <button type="submit" disabled={isLoading}>
60 {isLoading ? "Generating..." : "Generate Image"}
61 </button>
62 </form>
64 {result && (
65 <div className="result">
66 <img src={result.imageUrl} alt="Generated image" />
67 <p>Image saved as: {result.savedUrl}</p>
68 </div>
69 )}
94 <meta charset="UTF-8">
95 <meta name="viewport" content="width=device-width, initial-scale=1.0">
96 <title>AI Image Generator</title>
97 <style>${css}</style>
98 </head>
174 if (resultData.status === "succeeded") {
175 console.log("Generation succeeded!");
176 let imageUrl: string | undefined;
177
178 if (Array.isArray(resultData.output)) {
179 imageUrl = resultData.output[0];
180 } else if (typeof resultData.output === "string") {
181 imageUrl = resultData.output;
182 }
183
184 if (imageUrl) {
185 const { blob } = await import("https://esm.town/v/std/blob");
186 const timestamp = new Date().getTime();
187 const imageName = `generated-image-${timestamp}.jpg`;
188
189 const imageResponse = await fetch(imageUrl);
190 if (!imageResponse.ok) throw new Error("Failed to download image");
191
192 const imageBlob = await imageResponse.blob();
193 await blob.set(imageName, imageBlob);
194
195 return new Response(JSON.stringify({ imageUrl, savedUrl: imageName }), {
196 headers: { "Content-Type": "application/json" },
197 });
199 }
200 } else {
201 console.log("Using Val Town's free image generator...");
202 const imageUrl = `https://maxm-imggenurl.web.val.run/${encodeURIComponent(prompt)}`;
203
204 const { blob } = await import("https://esm.town/v/std/blob");
205 const timestamp = new Date().getTime();
206 const imageName = `generated-image-${timestamp}.jpg`;
207
208 const imageResponse = await fetch(imageUrl);
209 if (!imageResponse.ok) throw new Error("Failed to generate image");
210
211 const imageBlob = await imageResponse.blob();
212 await blob.set(imageName, imageBlob);
213
214 return new Response(JSON.stringify({ imageUrl, savedUrl: imageName }), {
215 headers: { "Content-Type": "application/json" },
216 });
217 }
218
219 return new Response(JSON.stringify({ error: "Failed to generate image" }), {
220 status: 500,
221 headers: { "Content-Type": "application/json" },

laudableFuchsiaMastodonmain.tsx32 matches

@stevekrouseUpdated 6 months ago
8 const [isLoading, setIsLoading] = useState(false);
9 const [error, setError] = useState("");
10 const [imageUrl, setImageUrl] = useState("");
11
12 const handleSubmit = async (e: React.FormEvent) => {
14 setIsLoading(true);
15 setError("");
16 setImageUrl("");
17
18 try {
24
25 if (!response.ok) {
26 throw new Error("Failed to generate image");
27 }
28
29 const data = await response.json();
30 setImageUrl(data.imageUrl);
31 } catch (err) {
32 setError(err.message);
38 return (
39 <div className="container">
40 <h1>AI Image Generator</h1>
41 <form onSubmit={handleSubmit}>
42 <textarea
43 value={prompt}
44 onChange={(e) => setPrompt(e.target.value)}
45 placeholder="Enter your image prompt here..."
46 required
47 />
56 </div>
57 <button type="submit" disabled={isLoading}>
58 {isLoading ? "Generating..." : "Generate Image"}
59 </button>
60 </form>
61 {error && <p className="error">{error}</p>}
62 {imageUrl && (
63 <div className="image-container">
64 <img src={imageUrl} alt="Generated" />
65 </div>
66 )}
142 if (resultData.status === "succeeded") {
143 console.log("Generation succeeded!");
144 let imageUrl: string | undefined;
145
146 if (Array.isArray(resultData.output)) {
147 imageUrl = resultData.output[0];
148 } else if (typeof resultData.output === "string") {
149 imageUrl = resultData.output;
150 }
151
152 if (imageUrl) {
153 const { blob } = await import("https://esm.town/v/std/blob");
154 const timestamp = new Date().getTime();
155 const imageName = `generated-image-${timestamp}.jpg`;
156
157 const imageResponse = await fetch(imageUrl);
158 if (!imageResponse.ok) throw new Error("Failed to download image");
159
160 const imageBlob = await imageResponse.blob();
161 await blob.set(imageName, imageBlob);
162
163 return new Response(JSON.stringify({ imageUrl, savedUrl: imageName }), {
164 headers: { "Content-Type": "application/json" },
165 });
167 }
168 } else {
169 console.log("Using Val Town's free image generator...");
170 const imageUrl = `https://maxm-imggenurl.web.val.run/${encodeURIComponent(prompt)}`;
171
172 const { blob } = await import("https://esm.town/v/std/blob");
173 const timestamp = new Date().getTime();
174 const imageName = `generated-image-${timestamp}.jpg`;
175
176 const imageResponse = await fetch(imageUrl);
177 if (!imageResponse.ok) throw new Error("Failed to generate image");
178
179 const imageBlob = await imageResponse.blob();
180 await blob.set(imageName, imageBlob);
181
182 return new Response(JSON.stringify({ imageUrl, savedUrl: imageName }), {
183 headers: { "Content-Type": "application/json" },
184 });
185 }
186
187 return new Response(JSON.stringify({ error: "Failed to generate image" }), {
188 status: 500,
189 headers: { "Content-Type": "application/json" },
197 <meta charset="UTF-8">
198 <meta name="viewport" content="width=device-width, initial-scale=1.0">
199 <title>AI Image Generator</title>
200 <style>${css}</style>
201 </head>
280}
281
282.image-container {
283 margin-top: 20px;
284 text-align: center;
285}
286
287.image-container img {
288 max-width: 100%;
289 border-radius: 4px;

shirtGenScriptmain.tsx19 matches

@stevekrouseUpdated 6 months ago
64 if (resultData.status === "succeeded") {
65 console.log("Generation succeeded!");
66 let imageUrl: string | undefined;
67
68 if (Array.isArray(resultData.output)) {
69 imageUrl = resultData.output[0];
70 } else if (typeof resultData.output === "string") {
71 imageUrl = resultData.output;
72 }
73
74 if (imageUrl) {
75 const { blob } = await import("https://esm.town/v/std/blob");
76 const timestamp = new Date().getTime();
77 const imageName = `generated-image-${timestamp}.jpg`;
78
79 const imageResponse = await fetch(imageUrl);
80 if (!imageResponse.ok) throw new Error("Failed to download image");
81
82 const imageBlob = await imageResponse.blob();
83 await blob.set(imageName, imageBlob);
84
85 return new Response(JSON.stringify({ imageUrl, savedUrl: imageName }), {
86 headers: { "Content-Type": "application/json" },
87 });
89 }
90 } else {
91 console.log("Using Val Town's free image generator...");
92 const imageUrl = `https://maxm-imggenurl.web.val.run/${encodeURIComponent(prompt)}`;
93
94 const { blob } = await import("https://esm.town/v/std/blob");
95 const timestamp = new Date().getTime();
96 const imageName = `generated-image-${timestamp}.jpg`;
97
98 const imageResponse = await fetch(imageUrl);
99 if (!imageResponse.ok) throw new Error("Failed to generate image");
100
101 const imageBlob = await imageResponse.blob();
102 await blob.set(imageName, imageBlob);
103
104 return new Response(JSON.stringify({ imageUrl, savedUrl: imageName }), {
105 headers: { "Content-Type": "application/json" },
106 });
107 }
108
109 return new Response(JSON.stringify({ error: "Failed to generate image" }), {
110 status: 500,
111 headers: { "Content-Type": "application/json" },

shirtGenScriptmain.tsx19 matches

@stevekrouseUpdated 6 months ago
64 if (resultData.status === "succeeded") {
65 console.log("Generation succeeded!");
66 let imageUrl: string | undefined;
67
68 if (Array.isArray(resultData.output)) {
69 imageUrl = resultData.output[0];
70 } else if (typeof resultData.output === "string") {
71 imageUrl = resultData.output;
72 }
73
74 if (imageUrl) {
75 const { blob } = await import("https://esm.town/v/std/blob");
76 const timestamp = new Date().getTime();
77 const imageName = `generated-image-${timestamp}.jpg`;
78
79 const imageResponse = await fetch(imageUrl);
80 if (!imageResponse.ok) throw new Error("Failed to download image");
81
82 const imageBlob = await imageResponse.blob();
83 await blob.set(imageName, imageBlob);
84
85 return new Response(JSON.stringify({ imageUrl, savedUrl: imageName }), {
86 headers: { "Content-Type": "application/json" },
87 });
89 }
90 } else {
91 console.log("Using Val Town's free image generator...");
92 const imageUrl = `https://maxm-imggenurl.web.val.run/${encodeURIComponent(prompt)}`;
93
94 const { blob } = await import("https://esm.town/v/std/blob");
95 const timestamp = new Date().getTime();
96 const imageName = `generated-image-${timestamp}.jpg`;
97
98 const imageResponse = await fetch(imageUrl);
99 if (!imageResponse.ok) throw new Error("Failed to generate image");
100
101 const imageBlob = await imageResponse.blob();
102 await blob.set(imageName, imageBlob);
103
104 return new Response(JSON.stringify({ imageUrl, savedUrl: imageName }), {
105 headers: { "Content-Type": "application/json" },
106 });
107 }
108
109 return new Response(JSON.stringify({ error: "Failed to generate image" }), {
110 status: 500,
111 headers: { "Content-Type": "application/json" },

gpt-image-test1 file match

@CaptainJackUpdated 23 hours ago
测试 gpt image 的不同 api 能否满足图片生成要求

image-inpainting1 file match

@themichaellaiUpdated 3 days 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