resumeConfigmain.tsx1 match
19"name": "Thomas Davis",
20"label": "Web Developer",
21"image": "https://avatars0.githubusercontent.com/u/416209?s=460&u=38f220a2c9c658141804f881c334c594eb1642ac&v=4",
22"summary":
23"I'm a full stack web developer who can build apps from the ground up. I've worked mostly at startups so I am used to wearing many hats. I am a very product focused developer who prioritizes user feedback first and foremost. I'm generally very flexible when investigating new roles. ",
modifyImagemain.tsx6 matches
1import { ImageMagick, initializeImageMagick, MagickGeometry } from "https://deno.land/x/imagemagick_deno@0.0.14/mod.ts";
23export async function modifyImage(
4input: Uint8Array | "logo:",
5) {
6return new Promise<File>((resolve) => {
7ImageMagick.read(input, (image) => {
8image.trim();
9image.repage();
10image.write((data) => resolve(new File([data], "logo.png", { type: "image/png" })));
11});
12});
modifyImageREADME.md2 matches
1Code from https://deno.com/blog/build-image-resizing-api
23Useful for compressing an image before sending to chatgpt4v, for example
imageMagickWasmExamplemain.tsx11 matches
1import {
2ImageMagick,
3initializeImageMagick,
4Magick,
5MagickFormat,
6Quantum,
7} from "https://esm.sh/@imagemagick/magick-wasm";
89const resp = await fetch("https://esm.sh/@imagemagick/magick-wasm@0.0.29/dist/magick.wasm");
10const wasmBytes = await resp.arrayBuffer();
1112initializeImageMagick(wasmBytes).then(() => {
13console.log(Magick.imageMagickVersion);
14console.log("Delegates:", Magick.delegates);
15console.log("Features:", Magick.features);
1718console.log("");
19ImageMagick.read("logo:", image => {
20image.resize(100, 100);
21image.blur(1, 5);
22console.log(image.toString());
2324image.write(MagickFormat.Jpeg, data => {
25console.log(data.length);
26});
23"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\" ",
24),
25{ headers: { "Content-Type": "image/svg+xml" } },
26);
27}
14};
1516const promptKey = 'imagePromptValue';
1718export function updateForm() {
4546const model = document.getElementById('model').value;
47const imageSize = document.getElementById('image_size')?.value;
48const prompt = document.getElementById('prompt').value;
4959loadingShimmer.className = 'loading-shimmer';
6061const imageFooter = document.createElement('div');
62imageFooter.className = 'image-footer';
6364const modelElement = document.createElement('p');
71removeButton.onclick = () => loadingContainer.remove();
7273imageFooter.appendChild(modelElement);
74imageFooter.appendChild(removeButton);
7576loadingContainer.appendChild(loadingShimmer);
77loadingContainer.appendChild(imageFooter);
78resultDiv.prepend(loadingContainer);
7987'landscape_16_9': 16 / 9
88};
89const aspectRatio = aspectRatios[imageSize] || 1; // Default to 1 if imageSize is not found
90const containerWidth = loadingContainer.offsetWidth;
91loadingShimmer.style.height = `${containerWidth / aspectRatio}px`;
97const guidanceScale = document.getElementById('guidance_scale')?.value;
98const seed = document.getElementById('seed')?.value;
99const numImages = document.getElementById('num_images')?.value;
100const enableSafetyChecker = document.getElementById('enable_safety_checker')?.checked;
101const syncMode = document.getElementById('sync_mode')?.checked;
108prompt,
109negative_prompt: negativePrompt || undefined,
110image_size: imageSize,
111num_inference_steps: numInferenceSteps ? parseInt(numInferenceSteps) : undefined,
112guidance_scale: guidanceScale ? parseFloat(guidanceScale) : undefined,
113seed: seed ? parseInt(seed) : undefined,
114num_images: numImages ? parseInt(numImages) : undefined,
115enable_safety_checker: enableSafetyChecker !== undefined ? enableSafetyChecker : undefined,
116sync_mode: syncMode !== undefined ? syncMode : undefined,
119};
120121const response = await fetch('/generate-image', {
122method: 'POST',
123headers: {
128129const data = await response.json();
130handleImageResponse(data, imageSize, model);
131}
132133function handleImageResponse(data, imageSize, model) {
134const resultDiv = document.getElementById('result');
135136if (data.imageUrls) {
137data.imageUrls.forEach((imageUrl, index) => {
138const imgElement = new Image();
139imgElement.src = imageUrl;
140imgElement.alt = `Generated Image ${index + 1}`;
141imgElement.style.display = 'none';
142147loadingShimmer.remove();
148imgElement.style.display = 'block';
149loadingContainer.insertBefore(imgElement, loadingContainer.querySelector('.image-footer'));
150};
151173updateForm();
174const modelElement = document.getElementById('model');
175const formElement = document.getElementById('imageForm');
176const resetButton = document.getElementById('resetButton');
177
3Outputs:
4```text
5ImageMagick 7.1.1-30 Q8 x86_64 dd459b01f:20240407 https://imagemagick.org
6Delegates: freetype heic jng jp2 jpeg jxl lcms lqr openexr png raw tiff webp xml zlib
7Features: Cipher
19<Url type="text/html" method="get" template="https://janpaul123-valtownsemanticsearch.web.val.run/search?q={searchTerms}"/>
20<Url type="application/opensearchdescription+xml" template="https://janpaul123-valtownsemanticsearch.web.val.run/opensearch.xml"/>
21<Image height="16" width="16" type="image/png">https://pomdtr-favicons.web.val.run/val-town</Image>
22<moz:SearchForm>https://janpaul123-valtownsemanticsearch.web.val.run/search</moz:SearchForm>
23</OpenSearchDescription>`,
formStylesmain.tsx2 matches
112}
113114.image-container {
115display: flex;
116flex-direction: column;
120}
121122.image-footer {
123display: flex;
124justify-content: space-between;
textToImagePlaygroundmain.tsx13 matches
1import { generateImageHandler } from 'https://esm.town/v/iamseeley/generateImageHandler';
2import { realtimeGenerateImageHandler } from 'https://esm.town/v/iamseeley/realtimeGenerateImageHandler';
3import { formStyles } from "https://esm.town/v/iamseeley/formStyles";
49<meta charset="UTF-8">
10<meta name="viewport" content="width=device-width, initial-scale=1.0">
11<title>Image Generator</title>
12<style>
13${formStyles}
16<body>
17<header>
18<h2>Text to Image Playground</h2>
19<a target="blank" href="https://fal.ai">fal.ai</a>
20</header>
25</select> -->
26
27<form id="imageForm">
28<label for="model">Model:</label>
29<select id="model" name="model">
40</div>
41<div class="buttons">
42<button type="submit">Generate Image</button>
43<button type="button" id="resetButton">Reset</button>
44</div>
63const type = this.value;
64if (type === 'regular') {
65document.getElementById('imageForm').style.display = 'block';
66document.getElementById('realtimeForm').style.display = 'none';
67} else {
68document.getElementById('imageForm').style.display = 'none';
69document.getElementById('realtimeForm').style.display = 'block';
70}
74window.addEventListener('DOMContentLoaded', (event) => {
75document.getElementById('generationType').value = 'regular';
76document.getElementById('imageForm').style.display = 'block';
77document.getElementById('realtimeForm').style.display = 'none';
78});
90status: 200,
91});
92} else if (req.method === 'POST' && url.pathname === '/generate-image') {
93return generateImageHandler(req);
94// } else if (req.method === 'POST' && url.pathname === '/realtime-generate-image') {
95// return realtimeGenerateImageHandler(req);
96} else {
97return new Response('Not Found', { status: 404 });