What Happens to Your Photo in an AI Tool
By Junaid Aslam. 7 min read. Updated .
An AI photo tool moves your file through three stages. The browser prepares a copy, the server chooses a model, and a provider returns text. The AI Image Analyzer follows that path. The details matter because a small photo can leave your device with its GPS tag intact, while a large photo is rebuilt without it.
This guide traces the code in the public repository. It also reports a real EXIF test on two files. The test used a CC0 photo, and we wrote a GPS tag into it first. One file stayed under the resize limit. The other was much larger.
1. The browser makes the first copy
The upload starts in apps/web/src/lib/image-upload.ts. The browser reads the file with FileReader and turns it into a data URL. The page also reads the image dimensions so it can warn about small files.
The analyzer then calls compressDataUrlForApi in apps/web/src/lib/ai-api.ts. That function has two jobs: keep the request body under the Vercel limit, and keep the image token count low. It caps the long edge at 1536 pixels and the data URL at 3.2 million characters.
There is a fast path. If the image is already 1536 pixels or smaller and the data URL is under the character cap, the function returns the original data URL unchanged. The original file, including its metadata, is what the browser sends.
A larger image takes the slow path. The browser decodes the file, draws it to a Canvas at up to 1536 pixels, and encodes a new JPEG. It tries quality 0.9, 0.78, 0.65, and 0.5 until the data URL fits. A Canvas encode creates new pixels. It does not copy the EXIF block from the source file.
| Test file | Original size | Sent size | Sent pixels | Same bytes | GPS in sent file |
|---|---|---|---|---|---|
| Small CC0 photo | 290,178 B | 290,178 B | 1200 x 900 | Yes | Yes |
| Large CC0 photo | 2,429,018 B | 411,080 B | 1536 x 1152 | No | No |
The small file took the fast path. The large file took the Canvas path. That difference decides whether the GPS tag survives.
2. The request to the analyzer
The page sends one POST request to /api/analyze-image. The JSON body has two fields: image and prompt. The image is the data URL from the step above. The prompt is the full-analysis instruction when the question box is empty.
The route in apps/web/src/app/api/analyze-image/route.ts adds a guardrail. The guardrail tells the model to answer only about the uploaded photo. If the prompt asks for something unrelated, the model returns a fixed refusal sentence.
Two limits apply before the request reaches a model. The route allows about 8 requests per minute from one IP address. The client allows 20 analyses per browser tab per day. Both values live in _limits.ts, and a test fails if the route and the page drift apart. Follow-up chat has a separate limit of 6 turns per image.
There is no account and no API key. The browser sends the image and the prompt. The server returns the model text, the provider name, and a success flag.
3. The provider chain
The server tries Gemini first. The vision chain in apps/web/src/app/api/_gemini.ts is gemini-3.1-flash-lite, then gemini-3-flash-preview, then gemini-3.5-flash. The cheapest model comes first to protect the shared quota.
If every Gemini model is rate limited or overloaded, the server tries up to two free providers. The production list in _providers.ts starts with Groq, then OpenRouter, then Cloudflare Workers AI. A separate development group (GitHub Models, NVIDIA, Mistral, Cerebras) can join only when ENABLE_DEV_AI_PROVIDERS is on.
If the free providers also fail, the request stops and the page shows a "busy" message. The site does not use a paid AI provider.
The fallback is narrow. A rate limit, an overload, or a retired model can move the request to the next option. A safety block or a bad request stops the chain. That stops a blocked image from being sent to every provider in turn.
The Privacy Policy names Google Gemini first, then Groq, OpenRouter, Cloudflare Workers AI, or similar. The code and the policy use the same list.
4. Two caches sit in front of the model
The page keeps a cache in sessionStorage. The key combines the image payload, the prompt, and the mode. The entry lasts for the life of the tab. A new tab starts with an empty cache.
The server has a second cache. It lives in memory, and each entry expires one hour after its last use. The key includes the request kind, the prompt, the system guardrail, the model chain, and the full image data URL. A byte-identical request returns the stored text without another provider call. The cache stores the text, the provider, and the model name. It does not store the image or the prompt.
The server cache is per isolate, so it is best effort. It also means a fresh tab is not enough to force a new model call. In the three-quality photo test, three repeats per file returned cached text until the test changed the MIME-type case in the request.
5. What the server logs
The shared log helper in apps/web/src/app/api/_ai_log.ts writes two JSON events. ai_attempt records one try at one tier. ai_request records the final outcome for the whole request. Both use a requestId so the lines group together.
The fields are names and numbers. They include route, kind, tier, name, attempt, outcome, errorKind, httpStatus, delayMs, ms, servedBy, providersTried, promptTokens, outputTokens, totalTokens, and imageChars. imageChars is the character count of the data URL, not the image itself.
No log call adds the image, the prompt, or the model reply. The only free-text field is message on an attempt, or upstreamMessage on a failed chain. That text is an upstream error. It is a real risk. During the three-quality photo test, a malformed base64 image made Gemini return a 400 error that echoed a long base64 string. The old log line wrote that string to the production log.
The shared log helper now redacts any base64 run of 80 characters or more. It also cuts an attempt message to 200 characters. The final error path redacts the upstream message before it writes the line. A test in _ai_log.test.ts covers the redaction.
The route does not add the image, the prompt, or the model reply to a log line. It logs [analyze-image] No AI providers configured. when no provider is set. That line has no user content.
6. The EXIF test
The test used a CC0 photo of a no-parking sign in Plaridel, Philippines, by JWilz12345. The source is the Commons file. The original file had no GPS tag, so we added one at 14.88878 N, 120.86665 E. The exact coordinates are not a real location claim. They let us see what survived the path.
We loaded each file in the production analyzer, left the question box empty, and captured the POST body in the browser. We decoded the image field and ran the result through an EXIF parser. The small file was 1200 by 900 pixels. The large file was 4128 by 3096 pixels.
The small file was sent byte for byte. The decoded bytes had the same SHA-256 hash as the source file. The GPS tag was still present. The large file was re-encoded to 1536 by 1152 pixels and 411,080 bytes. The EXIF parser found no tags in the sent copy.
The result changes the usual advice. The analyzer does not strip location from every upload. It strips metadata when it rebuilds the image with Canvas. A photo that already fits the 1536-pixel cap keeps its EXIF block, including GPS.
7. What this means for your own photos
If a photo carries a location you do not want to share, remove the tag before you upload it. The EXIF Viewer reads the metadata in your browser and can remove it. Do that even for a small image, because the small-image path sends the original bytes.
Resizing in another editor usually rebuilds the image and drops metadata. Check the result before you trust it. The file name and the image preview do not show whether a GPS tag is still inside.
The analyzer describes photos. It does not clean them. Treat the upload as a copy of your file.
8. What this guide does not claim
This guide does not state a provider retention period. The Privacy Policy says free-tier providers may use inputs to improve their models, and each provider's terms apply. Read the provider's own page for its current retention and training rules.
The server cache is best effort. A different server instance can miss it. The rate limits are also best effort and per instance. They reduce bursts. They are not a security boundary.
The redaction now runs on every log write, and the malformed-image error line we found during the test is the only case we know of.
Tested on
2026-11-16 against the production AI Image Analyzer at commit e535c16, then rechecked on 2026-11-17 after the paid fallback tier was removed. The EXIF test used two files from the same CC0 photo: a 1200 by 900 JPEG and a 4128 by 3096 JPEG. The POST body was captured in the browser, decoded, and parsed with exifr. The log review used the route, _gemini.ts, _providers.ts, and _ai_log.ts.
Primary sources
- Google AI for Developers: Image understanding
- MDN: FileReader.readAsDataURL()
- Instant Tools Privacy Policy
Related tools
- AI Image Analyzer: run the path described here.
- EXIF Viewer: inspect or remove GPS and camera tags before you upload.
- Privacy Policy: the provider list and the data-handling statements.