When developers build tools for cleaning image metadata, one common implementation is surprisingly simple: load an image into a Canvas element and export it again.
This may remove some metadata, but it can also introduce changes to the encoded image data.
If the goal is to remove unnecessary information while preserving the image, it's worth understanding why metadata cleaning and image re-encoding are different operations.
1. Image Files Contain More Than Pixels
JPEG files can contain multiple kinds of information.
The compressed image data is only one part of the file.
Other structures can store:
- EXIF camera settings and GPS information
- XMP editing metadata
- IPTC editorial and attribution data
- ICC color profiles
- C2PA Content Credentials
These structures serve different purposes.
Some contain information users may want to remove for privacy reasons. Others can influence how the image is displayed or help establish its origin.
2. What Happens When You Re-Export a JPEG?
A common browser workflow looks like this:
- Load a JPEG into an image element.
- Draw it onto a Canvas.
- Export the Canvas to a new JPEG.
This is convenient for resizing or manipulating pixels.
However, JPEG typically uses lossy compression. Encoding an image again may introduce new compression artifacts even if no visible edits were intentionally made.
It can also change file size, metadata and other properties.
For a tool whose only purpose is to remove metadata, this extra processing may be unnecessary.
JPEG uses different markers and segments to organize information.
For example, EXIF and XMP commonly appear in application segments, while other structures can carry content provenance.
A format-aware metadata cleaner can parse these structures, identify supported metadata, and construct an output file without decoding and recompressing the image data.
But this requires care.
Removing an EXIF orientation tag without compensating for its effect may change the displayed orientation.
Removing an ICC profile may change how colors are interpreted.
Removing C2PA data may eliminate useful provenance evidence.
Therefore, safe metadata cleaning is not the same as deleting every non-image segment.
4. File Hashes Are Not Image Quality Tests
It's also useful to understand that two visually identical images can have different file hashes.
For example, this JavaScript helper computes a SHA-256 hash of a local file:
async function getSHA256(file) {
const buffer = await file.arrayBuffer();
const digest = await crypto.subtle.digest(
"SHA-256",
buffer
);
return Array.from(new Uint8Array(digest))
.map(byte => byte.toString(16).padStart(2, "0"))
.join("");
}
If you remove one metadata field, the resulting file hash will usually change.
That alone doesn't indicate any loss of image quality.
The hash identifies the file's bytes, not the visual quality of the photograph.
To verify a metadata-cleaning tool, developers should separately inspect the output metadata, file integrity, encoded image data, and visual presentation.
5. A Privacy-First Browser-Based Example
I've been exploring this approach while developing Untagly, a free browser-based photo metadata inspection and cleaning tool.
Untagly supports JPG, PNG, WebP, HEIC and AVIF files.
It can inspect and remove supported EXIF, XMP, IPTC, C2PA and other metadata without uploading the original images to a server.
The tool is designed to preserve the underlying image data without recompression.
There are important limitations: metadata removal doesn't erase pixel-embedded watermarks or guarantee that social platforms will change their AI-related labels.
6. What Developers Should Test
Before shipping a metadata cleaner, consider testing:
- Images with EXIF orientation information
- Images containing ICC color profiles
- Files with multiple metadata types
- Malformed or truncated image files
- Images with provenance records
- Outputs that must preserve encoded image data
Test both the metadata result and the image's behavior in commonly used viewers.
Final Thoughts
A photo metadata cleaner should help users understand and control information embedded in their files.
Avoiding unnecessary image recompression is one part of that goal.
The other part is knowing which information can safely be removed, which information matters for display, and which records should be preserved for attribution or provenance.
Good image privacy tooling requires more than deleting hidden bytes. It requires careful decisions about what those bytes mean.