Skip to content

Update Subject EXIF metadata when transforming images. #2946

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 1, 2025

Conversation

JimBobSquarePants
Copy link
Member

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Fixes #463

Adds automatic updating of SubjectLocation and SubjectArea EXIF metadata tags when transforming images.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR extends the metadata transformation pipeline to propagate EXIF subject location and area when images are transformed.

  • ImageFrameMetadata now accepts a transformation matrix and calls SyncSubject to adjust EXIF tags.
  • All format-specific metadata classes and interfaces have been updated to include a Matrix4x4 matrix parameter in AfterImageApply/AfterFrameApply.
  • Added using System.Numerics; to enable Matrix4x4 references.

Reviewed Changes

Copilot reviewed 41 out of 41 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/ImageSharp/Metadata/ImageFrameMetadata.cs Added matrix parameter to AfterFrameApply and call to SyncSubject
src/ImageSharp/Formats/Webp/WebpMetadata.cs Updated AfterImageApply signature to include Matrix4x4 matrix
src/ImageSharp/Formats/Webp/WebpFrameMetadata.cs Updated AfterFrameApply signature to include Matrix4x4 matrix
src/ImageSharp/Formats/Tiff/TiffMetadata.cs Updated AfterImageApply signature to include Matrix4x4 matrix
src/ImageSharp/Formats/Tiff/TiffFrameMetadata.cs Updated AfterFrameApply signature to include Matrix4x4 matrix
src/ImageSharp/Formats/Tga/TgaMetadata.cs Updated AfterImageApply signature to include Matrix4x4 matrix
src/ImageSharp/Formats/Qoi/QoiMetadata.cs Updated AfterImageApply signature to include Matrix4x4 matrix
src/ImageSharp/Formats/Png/PngMetadata.cs Updated AfterImageApply signature to include Matrix4x4 matrix
src/ImageSharp/Formats/Png/PngFrameMetadata.cs Updated AfterFrameApply signature to include Matrix4x4 matrix
src/ImageSharp/Formats/Pbm/PbmMetadata.cs Updated AfterImageApply signature to include Matrix4x4 matrix
src/ImageSharp/Formats/Jpeg/JpegMetadata.cs Updated AfterImageApply signature to include Matrix4x4 matrix
src/ImageSharp/Formats/Ico/IcoMetadata.cs Updated AfterImageApply signature to include Matrix4x4 matrix
src/ImageSharp/Formats/Ico/IcoFrameMetadata.cs Updated AfterFrameApply signature to include Matrix4x4 matrix
src/ImageSharp/Formats/IFormatMetadata.cs Added Matrix4x4 matrix parameter to AfterImageApply in interface
src/ImageSharp/Formats/IFormatFrameMetadata.cs Added Matrix4x4 matrix parameter to AfterFrameApply in interface
src/ImageSharp/Formats/Gif/GifMetadata.cs Updated AfterImageApply signature to include Matrix4x4 matrix
src/ImageSharp/Formats/Gif/GifFrameMetadata.cs Updated AfterFrameApply signature to include Matrix4x4 matrix
src/ImageSharp/Formats/Cur/CurMetadata.cs Updated AfterImageApply signature to include Matrix4x4 matrix
src/ImageSharp/Formats/Cur/CurFrameMetadata.cs Updated AfterFrameApply signature to include Matrix4x4 matrix
src/ImageSharp/Formats/Bmp/BmpMetadata.cs Updated AfterImageApply signature to include Matrix4x4 matrix
Comments suppressed due to low confidence (1)

src/ImageSharp/Formats/IFormatFrameMetadata.cs:27

  • [nitpick] The parameter name matrix is quite generic; consider renaming it to transformationMatrix for greater clarity in overrides.
public void AfterFrameApply<TPixel>(ImageFrame<TPixel> source, ImageFrame<TPixel> destination, Matrix4x4 matrix)

@JimBobSquarePants JimBobSquarePants merged commit 9e29af2 into main Jul 1, 2025
8 checks passed
@JimBobSquarePants JimBobSquarePants deleted the js/transform-metadata branch July 1, 2025 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: handle Subject* metadata in Resize/Crop/Rotate transforms
1 participant