neatChocolateLynxmain.tsx2 matches
43</Col>
44<Col md={6}>
45<img src="https://maxm-imggenurl.web.val.run/futuristic-gaming-setup-with-rgb-lights" alt="Setup Gaming" className="img-fluid rounded shadow gaming-image" loading="lazy" />
46</Col>
47</Row>
397}
398399.gaming-image {
400border: 2px solid #00ffff;
401box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
scholarlyRedWhalemain.tsx2 matches
43</Col>
44<Col md={6}>
45<img src="https://maxm-imggenurl.web.val.run/futuristic-gaming-setup-with-rgb-lights" alt="Setup Gaming" className="img-fluid rounded shadow gaming-image" loading="lazy" />
46</Col>
47</Row>
397}
398399.gaming-image {
400border: 2px solid #00ffff;
401box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
6const url = new URL(req.url);
7// console.log("url:", url)
8const isImage = url.pathname.endsWith("/image");
910if (isImage) {
11const imageUrl = `https://api.apiflash.com/v1/urltoimage?access_key=${
12Deno.env.get("APIFLASH_API_KEY")
13}&url=${url.origin}&format=png&width=1200&height=800&scale_factor=2`;
14// const imageUrl = "https://charlypoly-httpapiscreenshotpageexample.web.val.run/?url=" + url.origin;
15// return Response.redirect(imageUrl, 302)
16const res = await fetch(imageUrl);
17const blob = await res.blob();
18return new Response(blob, { headers: { "Content-Type": "image/png" } });
19}
2023const v2fcframe = {
24version: "next",
25imageUrl: baseUrl + "/image",
26button: {
27title: title,
30name: title,
31url: baseUrl,
32// splashImageUrl: baseUrl + "/image",
33splashBackgroundColor: "#111111",
34},
40<head>
41<title>${title}</title>
42<meta property="og:image" content="${url.origin}/image" />
43<meta property="og:image:width" content="800" />
44<meta property="og:image:height" content="800" />
45<meta name="twitter:card" content="summary_large_image" />
46<meta name="fc:frame" content="${JSON.stringify(v2fcframe).replace(/"/g, """)}" />
47<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.10.0/p5.min.js" integrity="sha512-lvddmeF7aHRJwdbJeYThWd5kWSjTrXBzCRF/jYROiHzmhMJ1dEXfGH5Q7ft0yhizXTopAETG03s5ajTflauijA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
countryOutlineSVGmain.tsx1 match
82return new Response(svg, {
83headers: {
84"Content-Type": "image/svg+xml",
85"Access-Control-Allow-Origin": "*",
86},
unicodeToSVGmain.tsx1 match
50return new Response(svgResponse, {
51headers: {
52'Content-Type': 'image/svg+xml',
53'Access-Control-Allow-Origin': '*'
54}
1import { Image } from "https://deno.land/x/imagescript@1.2.15/mod.ts";
23function encodeURL(url: string): string {
1011const {
12w, // Width of the output image
13h, // Height of the output image
14fit, // Fit mode for resizing: 'cover' or 'contain'
15background, // Background color for 'contain' mode or transparent areas
16withoutEnlargement, // Whether to prevent enlarging the image
17format = 'base64' // URL format: 'base64' or 'plain'
18} = Object.fromEntries(params);
2223if (!inputUrl) {
24const exampleUrl = "https://example.com/image.jpg";
25const encodedExampleUrl = encodeURL(exampleUrl);
26const baseUrl = `${url.protocol}//${url.host}/`;
27const exampleBase64 = `${baseUrl}${encodedExampleUrl}?format=base64`;
28const examplePlain = `${baseUrl}${exampleUrl}?format=plain`;
29return new Response(`Error: No image URL provided. Please include a URL in the path and specify the format using the 'format' parameter.
3031Example usage:
442. w (integer, optional):
45- Values: Any positive integer
46- Specifies the desired width of the output image in pixels
47- If omitted, the original image width is used
48- Example: w=300
49503. h (integer, optional):
51- Values: Any positive integer
52- Specifies the desired height of the output image in pixels
53- If omitted, the original image height is used
54- Example: h=200
55564. fit (string, optional):
57- Values: 'cover' (default) or 'contain'
58- Determines how the image should be resized to fit the specified dimensions
59- 'cover': The image will fill the specified dimensions while maintaining its aspect ratio, potentially cropping the image
60- 'contain': The image will be resized to fit within the specified dimensions while maintaining its aspect ratio, potentially adding letterboxing
61- Example: fit=contain
62696. withoutEnlargement (string, optional):
70- Values: 'true' or 'false' (default)
71- When set to 'true', prevents the image from being enlarged if the requested dimensions are larger than the original image
72- Example: withoutEnlargement=true
7374Usage notes:
75- The image URL should be provided in the path of the request URL
76- At least one of 'w' or 'h' should be provided to resize the image
77- If only one of 'w' or 'h' is provided, the other dimension will be calculated to maintain the aspect ratio
78- The 'background' parameter is only used when 'fit' is set to 'contain' or when the image has transparent areas
79- All parameters are optional. If not provided, default values or original image properties will be used`,
80{ status: 400 });
81}
8283let imageUrl;
84try {
85if (format === 'base64') {
86imageUrl = decodeURIComponent(atob(inputUrl));
87} else if (format === 'plain') {
88imageUrl = decodeURIComponent(inputUrl);
89} else {
90throw new Error('Invalid format specified. Use "base64" or "plain".');
91}
92console.log('Processed URL:', imageUrl);
93} catch (error) {
94return new Response(`Error processing URL: ${error.message}. Please ensure the URL is correctly formatted and the format is specified correctly.`, { status: 400 });
9697try {
98console.log('Fetching image from:', imageUrl);
99const response = await fetch(imageUrl);
100if (!response.ok) {
101throw new Error(`HTTP error! status: ${response.status}`);
103const arrayBuffer = await response.arrayBuffer();
104105let image = await Image.decode(new Uint8Array(arrayBuffer));
106107const targetWidth = w ? parseInt(w) : image.width;
108const targetHeight = h ? parseInt(h) : image.height;
109110if (withoutEnlargement === "true" && (targetWidth > image.width || targetHeight > image.height)) {
111// Don't enlarge the image
112} else {
113if (fit === "contain") {
114image = image.contain(targetWidth, targetHeight);
115} else {
116// Default to 'cover'
117image = image.cover(targetWidth, targetHeight);
118}
119}
121if (background) {
122try {
123const bgColor = Image.rgbaToColor(...JSON.parse(background));
124const bgImage = new Image(image.width, image.height);
125bgImage.fill(bgColor);
126image = bgImage.composite(image);
127} catch (error) {
128console.error('Error applying background:', error);
131}
132133const encodedImage = await image.encode();
134135return new Response(encodedImage, {
136status: 200,
137headers: {
138"Content-Type": "image/png",
139"Cache-Control": "max-age=86400"
140}
141});
142} catch (error) {
143console.error('Error processing image:', error);
144let errorMessage = `Error processing image: ${error.message}. `;
145if (error.message.includes('HTTP error')) {
146errorMessage += 'The image could not be fetched from the provided URL. Please check if the URL is correct and accessible.';
147} else if (error.message.includes('decode')) {
148errorMessage += 'The image could not be decoded. Please ensure the URL points to a valid image file.';
149} else if (error.message.includes('client error (Connect)')) {
150errorMessage += 'There was a network error while trying to fetch the image. This might be due to network restrictions or the image server being unreachable.';
151} else {
152errorMessage += 'An unexpected error occurred while processing the image. Please try again or contact support if the issue persists.';
153}
154return new Response(errorMessage, { status: 500 });
removeBackgroundPhotomain.tsx26 matches
45function BackgroundRemover() {
6const [image, setImage] = useState<string | null>(null);
7const [processedImage, setProcessedImage] = useState<string | null>(null);
8const canvasRef = useRef<HTMLCanvasElement>(null);
910const handleImageUpload = (e: React.ChangeEvent<HTMLInputElement>) => {
11const file = e.target.files?.[0];
12if (file) {
13const reader = new FileReader();
14reader.onload = (event) => {
15setImage(event.target?.result as string);
16};
17reader.readAsDataURL(file);
2021const removeBackground = () => {
22if (!canvasRef.current || !image) return;
2324const canvas = canvasRef.current;
25const ctx = canvas.getContext('2d');
26const img = new Image();
27img.onload = () => {
28canvas.width = img.width;
29canvas.height = img.height;
30ctx?.drawImage(img, 0, 0);
3132const imageData = ctx?.getImageData(0, 0, canvas.width, canvas.height);
33if (imageData) {
34for (let i = 0; i < imageData.data.length; i += 4) {
35// Simple background removal: make white/near-white pixels transparent
36const r = imageData.data[i];
37const g = imageData.data[i + 1];
38const b = imageData.data[i + 2];
39
40// If pixel is very close to white, make it transparent
41if (r > 240 && g > 240 && b > 240) {
42imageData.data[i + 3] = 0;
43}
44}
45ctx?.putImageData(imageData, 0, 0);
46setProcessedImage(canvas.toDataURL());
47}
48};
49img.src = image;
50};
5160<input
61type="file"
62accept="image/*"
63onChange={handleImageUpload}
64style={{ marginBottom: '10px' }}
65/>
66{image && (
67<div>
68<h2>Original Image</h2>
69<img
70src={image}
71alt="Original"
72style={{ maxWidth: '100%', maxHeight: '300px' }}
86</div>
87)}
88{processedImage && (
89<div>
90<h2>Processed Image</h2>
91<img
92src={processedImage}
93alt="Background Removed"
94style={{ maxWidth: '100%', maxHeight: '300px' }}
95/>
96<a
97href={processedImage}
98download="background-removed.png"
99style={{
ios_AppStoreFetchermain.tsx1 match
367368// Extract icon
369const iconUrlMatch = html.match(/<meta property="og:image" content="([^"]+)"/i);
370let iconUrl = iconUrlMatch ? iconUrlMatch[1] : null;
371
cerebras_codermain.tsx1 match
1191<meta property="og:description" content="Turn your ideas into fully functional apps in less than a second – powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
1192<meta property="og:type" content="website">
1193<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
1194
1195
blobStorageREADME.md1 match
3This is a lightweight Blob Admin interface to view and debug your Blob data.
45
67Versions 0-17 of this val were done with Hono and server-rendering.