Skip to content

Comments

Strip PNG metadata to fix Screenshotbot false positives#46

Open
EmilioBejasa wants to merge 4 commits intomainfrom
fix/strip-png-metadata
Open

Strip PNG metadata to fix Screenshotbot false positives#46
EmilioBejasa wants to merge 4 commits intomainfrom
fix/strip-png-metadata

Conversation

@EmilioBejasa
Copy link
Collaborator

Summary

  • Re-encodes PNG screenshots after tests complete to remove EXIF metadata (timestamps) that differ between runs
  • This fixes the Screenshotbot check failing with "ACTION_REQUIRED" on most PRs, where it detects file changes but the images are pixel-identical
  • Uses Android's BitmapFactory/Bitmap.compress() to decode and re-encode PNGs without metadata
  • Runs in BaseScreenshotTestRunner.finish() before ScreenshotRunner.onDestroy()

Test plan

  • CI screenshot-tests job passes
  • Screenshotbot check passes (no false positive diffs)

🤖 Generated with Claude Code

EmilioBejasa and others added 4 commits February 16, 2026 15:50
Re-encode screenshots after tests complete to remove EXIF timestamps
that cause Screenshotbot to flag identical images as changed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Strip metadata chunks (tIME, tEXt, iTXt, etc.) directly from PNG
files at the byte level. This preserves the exact pixel data bytes
unlike Bitmap.compress which may produce non-deterministic output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The on-device approach in BaseScreenshotTestRunner didn't work because
the Gradle plugin pulls screenshots from a different path. Instead,
hook into recordDebugAndroidTestScreenshotTest with a doLast block
that re-encodes PNGs via javax.imageio on the CI host after they've
been pulled from the emulator but before Screenshotbot uploads them.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@EmilioBejasa EmilioBejasa requested a review from tdrhq February 18, 2026 16:50
@EmilioBejasa EmilioBejasa marked this pull request as ready for review February 18, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant