Enhance AI content credential detection and metadata removal features across components

This commit is contained in:
sharif committed 2025-06-23 23:46:31 +06:00
1 parent d3bd49ccb1
commit 57415cb399
5 files changed
+517 -30

No files matched your search

+100 -2
View File
@@ -12,6 +12,9 @@
dispatch("processingStart");
try {
// Enhanced AI content credential detection before processing
await detectAndLogAICredentials();
const img = new Image();
img.onload = function () {
@@ -22,8 +25,11 @@
canvas.width = img.width;
canvas.height = img.height;
// Enhanced clearing for AI content credentials
ctx.clearRect(0, 0, canvas.width, canvas.height);
// Create a new clean image without any metadata containers
ctx.globalCompositeOperation = "source-over";
ctx.drawImage(img, 0, 0);
let outputType = "image/jpeg";
@@ -62,6 +68,72 @@
}
}
// Enhanced AI credential detection
async function detectAndLogAICredentials() {
try {
const { parse } = await import("exifr");
const fullMetadata = await parse(file, {
tiff: true,
exif: true,
gps: true,
xmp: true,
iptc: true,
icc: true,
jfif: true,
ihdr: true,
iptc: true,
photoshop: true,
silentErrors: true,
});
if (fullMetadata) {
console.log("🔍 Detected metadata before cleaning:", fullMetadata);
// Check for AI-specific metadata
const aiTags = [];
if (
fullMetadata.Software &&
typeof fullMetadata.Software === "string"
) {
const software = fullMetadata.Software.toLowerCase();
if (
software.includes("dall-e") ||
software.includes("dalle") ||
software.includes("chatgpt") ||
software.includes("openai") ||
software.includes("midjourney") ||
software.includes("stable diffusion")
) {
aiTags.push("AI Software Signature");
}
}
// Check for C2PA content credentials
if (
fullMetadata.Description &&
fullMetadata.Description.includes("c2pa")
) {
aiTags.push("C2PA Content Credentials");
}
if (
fullMetadata.Creator &&
(fullMetadata.Creator.includes("AI") ||
fullMetadata.Creator.includes("artificial intelligence"))
) {
aiTags.push("AI Creator Tags");
}
if (aiTags.length > 0) {
console.log("🤖 AI content credentials detected:", aiTags);
}
}
} catch (error) {
console.log("Could not analyze AI credentials:", error);
}
}
async function verifyCleanImage(cleanBlob, originalFile) {
try {
const { parse } = await import("exifr");
@@ -196,8 +268,10 @@
<div class="processor-section">
<div class="text-center mb-6">
<p class="text-secondary mb-4">
Remove all EXIF metadata from your image to protect your privacy. This
process happens entirely in your browser - no data is sent to any server.
Remove all EXIF metadata, AI content credentials, and provenance data from
your image to protect your privacy. This process happens entirely in your
browser - no data is sent to any server. Enhanced detection for C2PA
signatures, DALL-E watermarks, and other AI generation markers.
</p>
<button class="btn btn-primary btn-lg" on:click={processImage} {disabled}>
@@ -256,6 +330,30 @@
<span class="text-success">✓</span>
AI generation tags
</div>
<div class="flex items-center gap-2">
<span class="text-success">✓</span>
C2PA content credentials
</div>
<div class="flex items-center gap-2">
<span class="text-success">✓</span>
DALL-E/ChatGPT signatures
</div>
<div class="flex items-center gap-2">
<span class="text-success">✓</span>
Midjourney watermarks
</div>
<div class="flex items-center gap-2">
<span class="text-success">✓</span>
Stable Diffusion metadata
</div>
<div class="flex items-center gap-2">
<span class="text-success">✓</span>
Adobe AI provenance
</div>
<div class="flex items-center gap-2">
<span class="text-success">✓</span>
JUMBF metadata containers
</div>
</div>
</div>
</div>