ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: user4800 on April 09, 2010, 04:20:10 PM

Title: remove a lot of metatags without killing some
Post by: user4800 on April 09, 2010, 04:20:10 PM
Ok, i have read a lot of faq and docs and here's my problem...

I have a fully loaded exift xmp icc... jpg or tiff or generic image file and i want to remove alot of metatags... but i also want to mantain some useful tags into some of these...

basically a jpg file i'm currently working with have these groups

app14
xmp
icc
iptc
photoshop
exif
jfif

i want mantain only the tags marked in blue and remove that in red..

i also want to kill alot of tags into remaining sections but i prefere do the things one by another

first line could be something like this, i know you hate multi exclusion sintax for performance reason but this is not running on a website but on my workstation with a lot of res

exiftool -P -overwrite_original -all= --xmp:all --icc_profile:all --photoshop:all --exif:all --jfif:all  folder/*.jpg

at this point app14 and iptc are gone...

now i have a lot of stuff i don't like in exif

i can remove them by using 2 ways...

exiftool -P -overwrite_original -exif:all= -tagsfromfile @ -exif:tag1 -exif:tag2 -exif:tag3..... folder/*.jpg

removing all except some tags..

or

exiftool -P -overwrite_original -exif:TagBad1= -exif:TagBad2= ... folder/*.jpg

but actually i like the first cause i want delete almost all except some tags...

the tag i like to mantain are
ThumbnailOffset
ThumbnailLenght
ResolutionUnit
XResolution
YResolution
Compression

and some others...

What is the problem? that exiftool report that these tags are not writable... but i don't want to write them, i want only save them from deletion...

And at same time in others case i want to delete tags that are saying can't edit... but i don't want edit them.. i want only remove them...

is there a solution?
Title: Re: remove a lot of metatags without killing some
Post by: Phil Harvey on April 09, 2010, 06:16:53 PM
Quoteexiftool -P -overwrite_original -all= --xmp:all --icc_profile:all --photoshop:all --exif:all --jfif:all  folder/*.jpg

Excluding groups from deletion isn't a performance concern, so this is fine.

It sounds like you understand what is going on pretty well.  The only problem you are having is that you can't write ThumbnailOffset and ThumbnailLength.  These tags are written automatically when you write the ThumbnailImage.

So you can do all that you want in a single command.  Using the -@ option to keep the command line short, it sounds like you want to do something like this:

exiftool -@ my.args FOLDER

where "my.args" is something like this:

-P
-ext
jpg
-overwrite_original
-all=
--xmp:all
--icc_profile:all
--photoshop:all
--jfif:all
-tagsfromfile
@
-thumbnailimage
-resolutionunit
-xresolution
-yresolution
-compression
...


- Phil

Title: Re: remove a lot of metatags without killing some
Post by: user4800 on April 09, 2010, 06:42:33 PM
thank you for reply...

1) what's the second @ stands for?

-@ it's the argument for read all args from a file but...

the second @ in my.args file?

2) and... thumbnailimage where come's from? in https://exiftool.org/TagNames/EXIF.html i can't find it.. it was an example i have a tons of tags not directly writable... (and all i need to do is delete or preserve non edit with a custom value).. there's a page where i can find a sort of hierarchy of these tags?

regards
Title: Re: remove a lot of metatags without killing some
Post by: user4800 on April 10, 2010, 02:19:57 AM
update: ok for 1) it' a self referencing for tagsfromfile...

2) still pending... i have found -thumbnailimage only in an example, it's a undocumented stuff?

by the way your program rules but it require a degree to get skilled and full master all possibile command lines..
Title: Re: remove a lot of metatags without killing some
Post by: Phil Harvey on April 10, 2010, 06:14:33 AM
Quote from: user4800 on April 09, 2010, 06:42:33 PM
1) what's the second @ stands for?

This is the argument for the -tagsFromFile option, indicating you want to copy tags from the current file.  See the application documentation for details.  [Edit: oh, I see you figured this out]

Quote
2) and... thumbnailimage where come's from? in https://exiftool.org/TagNames/EXIF.html i can't find it..

In the EXIF tag name documentation, you will see a "*" in the Writable column for the EXIF ThumbnailOffset and ThumbnailLength tags.  This is explained on the first page of the tag name documentation:  "An asterisk (*) indicates a "protected" tag which is not writable directly, but is written automatically by exiftool (often when a corresponding Composite or Extra tag is written)".  If you look at the Composite tag name documentation (https://exiftool.org/TagNames/Composite.html) you will see the ThumbnailImage tag which is used to write these "protected" tags.

Quotei have a tons of tags not directly writable... (and all i need to do is delete or preserve non edit with a custom value).. there's a page where i can find a sort of hierarchy of these tags?

I'm not sure exactly what you are looking for here.  All writable tags are documented in the tag name documentation.  ExifTool will extract some types of tags (like XMP) which don't appear in this documentation, and these tags are not writable.  But EXIF tags aren't in this category (unless you use the -u option to extract unknown EXIF tags, but I doubt you would ever encounter one of these).

You are correct that exiftool is somewhat tricky to use.  The problem is that metadata can be very confusing, and ExifTool is so powerful and flexible that the documentation is rather lengthy and nobody has time to read all of it.  Often it is hard for the first-time user to wade through the documentation to extract the relevant information.

- Phil
Title: Re: remove a lot of metatags without killing some
Post by: user4800 on April 12, 2010, 03:07:17 AM
Actually there's a way to preserve from deleting not writable tags??

Like... i want to delete all photoshop stuff without these..

-PhotoshopThumbnail <-- most important for me
-PhotoshopFormat
-ProgressiveScans
-YResolution
-DisplayInfo
-BorderInformation
-PrintFlags
-DuotoneImageInfo
-XMLData
-RawImageMode
-Slices
-EffectsVisible
-VersionInfo

and so on...

or.. generally another category that have alot  of not writable tags...

note: i'm talking of prevent them from deletion not edit... your program only need to go around them and leave them alone without killing them... it seems the only permitted thin is remove all entire group...

actually using a string like that:

exiftool "-P" "-overwrite_original" "-photoshop:all=" -tagsfromfile @ -PhotoshopThumbnail -PhotoshopFormat -ProgressiveScans -YResolution -DisplayInfo -BorderInformation..... "*.jpg"

if that is not possibile, can i made a feature request of a command to remove or preserve selectively the not writable tag in the next version of your app? :D

ok you are going to kill me, but i think that a feature like that would be a necessary feature to all photographers around the world...
Title: Re: remove a lot of metatags without killing some
Post by: Phil Harvey on April 12, 2010, 07:42:04 AM
You are only the second person I have found who wants to edit the Photoshop information.  The first person's problems were solved by creating the necessary user-defined tags.  In your case, you could do the same thing and create user-defined tags for each Photoshop tag you want to preserve.  A command like this would do what you want:

exiftool -photoshop:all= -tagsfromfile @ -preservemytags FILE

with this config file:

%Image::ExifTool::UserDefined::Shortcuts = (
    PreserveMyTags => [
        'PhotoshopThumbnail',
        'JPEG_Quality',
        'ResolutionInfo',
        'DisplayInfo',
        'BorderInformation',
        'PrintFlags',
        'DuotoneImageInfo',
        'XMLData',
        'RawImageMode',
        'Slices',
        'EffectsVisible',
        'VersionInfo',
    ],
);

%Image::ExifTool::UserDefined = (
  'Image::ExifTool::Photoshop::Main' => {
    0x040c => { Name => 'PhotoshopThumbnail',Binary => 1 , Writable => 'undef' },
    0x0406 => { Name => 'JPEG_Quality',      Binary => 1 , Writable => 'undef' },
    0x03ed => { Name => 'ResolutionInfo',    Binary => 1 , Writable => 'undef' },
    0x03ef => { Name => 'DisplayInfo',       Binary => 1 , Writable => 'undef' },
    0x03f1 => { Name => 'BorderInformation', Binary => 1 , Writable => 'undef' },
    0x03f3 => { Name => 'PrintFlags',        Binary => 1 , Writable => 'undef' },
    0x03fa => { Name => 'DuotoneImageInfo',  Binary => 1 , Writable => 'undef' },
    0x03ea => { Name => 'XMLData',           Binary => 1 , Writable => 'undef' },
    0x0405 => { Name => 'RawImageMode',      Binary => 1 , Writable => 'undef' },
    0x041a => { Name => 'Slices',            Binary => 1 , Writable => 'undef' },
    0x0412 => { Name => 'EffectsVisible',    Binary => 1 , Writable => 'undef' },
    0x0421 => { Name => 'VersionInfo',       Binary => 1 , Writable => 'undef' },
  },
);

1;  #end


- Phil
Title: Re: remove a lot of metatags without killing some
Post by: user4800 on April 12, 2010, 08:44:39 AM
thank you!!

actually this way will work with all not writable tags? i must know and specify the address of tag i want preserve and define it as custom..

good workaround ;)
Title: Re: remove a lot of metatags without killing some
Post by: Phil Harvey on April 12, 2010, 09:22:04 AM
Quote from: user4800 on April 12, 2010, 08:44:39 AM
this way will work with all not writable tags?

Yes.  You can override any tag definitions with user-defined tags.  So you can define new writable tags for any type of information that ExifTool is capable of writing.

- Phil
Title: Re: remove a lot of metatags without killing some
Post by: user4800 on April 12, 2010, 12:57:26 PM
obviously an app like photoshop if see a tag with correct name and right referral will consider it as photoshop made tag... right??

what we call custom in this case will not finish in a sort of separate area... we are simply writing them out of exiftool standard manner...

so there's a question coming in my mind... why you don't have operated a writing technique like that to render ALL tags writable? it's a form question? to avoid that inexperienced user write tag in wrong manner like using string instead integers and stuff?

sorry for my english and my looong periods... xD

regards :P
Title: Re: remove a lot of metatags without killing some
Post by: Phil Harvey on April 12, 2010, 02:25:47 PM
Copying the photoshop tags is something that almost nobody wants to do (except maybe developers).  ExifTool is mainly concerned with image metadata, and this photoshop information is really stretching the scope of the project.  So I don't see a real need to add built-in write support for this stuff.

- Phil
Title: Re: remove a lot of metatags without killing some
Post by: user4800 on April 12, 2010, 04:05:21 PM
thank you for the support :D better than adobe one ;)