Skip to content
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

Option to replace EXIF metadata #2910

Open
stackcoder opened this issue Sep 30, 2021 · 1 comment
Open

Option to replace EXIF metadata #2910

stackcoder opened this issue Sep 30, 2021 · 1 comment

Comments

@stackcoder
Copy link

stackcoder commented Sep 30, 2021

What are you trying to achieve?
Discard all existing metadata of an image and only write entries specified within withMetadata to the file. The current behavior merges existing entries with the new ones.

Have you searched for similar questions?
Sure at least: #650, #2724, #2812, #2638, #2507

The strip tag of libvips is !baton->withMetadata controlled by !baton->withMetadata. So might be difficult to combine strip and updating metadata together within libvips. Is there any other option instead encoding the image twice?

// My current workaround:
sharp.prototype.discardMetadata = async function () {
  const {data, info} = await this
    .raw()
    .toBuffer({resolveWithObject: true});
  return sharp(data, {raw: info});
};

Are you able to provide a minimal, standalone code sample that demonstrates this question?
Already exists, there you go: https://sharp.pixelplumbing.com/api-output#withmetadata

Are you able to provide a sample image that helps explain the question?
Not required.

@lovell
Copy link
Owner

lovell commented Oct 20, 2021

Perhaps the API could look something like the following:

// PROPOSED API - NOT YET AVAILABLE
.withMetadata({
  exif: { key: "value" },
  exifReplace: true
})

Happy to accept a PR, if you're able.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants