Closed beschler closed 3 months ago
You've got several issues going on:
.deleteAllTags
function the array.-TAGNAME<TAGNAME
syntax, I've just added a new retain
argument to ExifTool.deleteAllTags
: feed it an array of tag names you want to retain. This will be in version 25.1.0.So:
import {exiftool} from "exiftool-vendored"
async function run() {
await exiftool.deleteAllTags(
"MY_IMAGE_FILE.jpg",
{ retain: ["Artist", "Copyright","DateTimeOriginal", /* and all the others you've got */] }
)
await exiftool.end()
}
There are several new tests so you can see it in action in WriteTask.spec.ts.
@mceachen, this is awesome!
Thank you so much for doing this. I will update my NPM package to download the new version which supports this retain
option, and give this a go.
I really appreciate your help with this 🙏🏻
Just FYI, there were a couple hangups with the release: GitHub Actions boxes didn't behave like my local test machines, so there's been some shenanigans in getting this out the door. It'll happen today.
Released!
Thank you so much @mceachen!
I see the new release in GitHub and NPM. I updated my package successfully to 25.1.0
.
npm install exiftool-vendored@latest
I updated my code per your recommendation, and it worked perfectly!
const exiftool = require("exiftool-vendored").exiftool;
async function run() {
await exiftool.deleteAllTags(
"6--IMG_6715.jpg",
{
retain: [
"exif:Artist",
"exif:Copyright",
"exif:DateTimeOriginal",
"exif:OffsetTimeOriginal",
"iptc:DateCreated",
"iptc:TimeCreated",
"iptc:By-line",
"iptc:By-lineTitle",
"iptc:Credit",
"iptc:Source",
"iptc:CopyrightNotice",
"xmp:DateCreated",
"xmp:Source",
"xmp:Credit",
"xmp:AuthorsPosition",
"xmp:creator",
"xmp:rights",
"xmp:UsageTerms",
"xmp:CreatorContactInfo",
"xmp:WebStatement"
]
}
);
await exiftool.end();
console.log( `SUCCESS!` );
}
run();
I can't thank you enough. I can now push forward with my project. (I made sure to give this repo a star.) Cheers! 🍻
QUESTION
How can I use
exiftool-vendored.js
to delete all metadata tags on an image file except those specified?USE CASE
I'm trying to remove all metadata on my file e.g. aperture, shutter speed, ISO, location, etc., but leave all information about copyright and author.
CODE
I have the following JS code:
ERROR
When I execute this code...
...I receive the following error:
SYSTEM
exiftool-vendored
: 25.0.0node
: 20.11.1npm
: 10.2.4MacBook Pro, 16-inch, 2023 Apple M2 Pro macOS Ventura 13.6.5
Thanks in advance for any assistance you can provide! Really appreciate all the hard work put into this project.