Resize image and strip metadata

Following the threads here, I created the following button

<?xml version="1.0"?> <button backcol="none" display="icon" textcol="none"> <label>Resize &amp; Erase Metadata</label> <tip>Resize to 800x600 &amp; Erase Metadata</tip> <icon1>#imageconversion</icon1> <function type="normal"> <instruction>@filesonly</instruction> <instruction>image convert=jpg here addsuffix=.resized width=800 height=800 preserveaspectratio</instruction> <instruction>select {file|noext}.resized.{file|ext}</instruction> <instruction>SetAttr META *</instruction> </function> </button>

But it doesn't work. It strips the metadata on the original file, rather than the new resized file. Any way to select the new file and make the operation occur on that? It needs to be able to work on multiple files.

Your button works just fine for me when I test it with JPGs. It strips the IPTC metadata but leaves the EXIF.

What types of files are you using this with?

Also, can you provide an example of the original file names?

The filenames are just normal camera names:


after resizing


The resized files still have their metadata (F9), whereas in the originals it's erased! That's the opposite of the desired behavior.

Try this:

@filesonly @nofilenamequoting Image convert=jpg here addsuffix=.resized width=800 height=800 preserveaspectratio SetAttr FILE "{file|noext}.resized.jpg" META *

{file|ext} includes the . so .{file|ext} will put two dots into the filename, which you don't want.

But you don't want to use {file|ext} at all anyway, since you're using convert=jpg which means all the output files will be .jpg which may not be what the input extension was.

Using Select to change which files are selected for subsequent commands is always a bad idea if you can pass the filename directly to the command, so I changed that as well.

Finally, I added @nofilenamequoting and put quotes around "{file|noext}.resized.jpg" so it works when there's a space in the filenames.

Thanks that works!!

I had one more question regarding stripping metadata. Does it actually remove the 10KB metadata from the file?

I did some testing the results are below:

Name                                                       Size
IMG_4385.JPG                                          1,262,246
IMG_4385 - Copy (set META).JPG                        1,260,060
IMG_4385 - stripped.JPG                               1,253,542
IMG_4385-thumbs.png                                      18,786
IMG_4385-thumbs - stripped.png                           17,413
IMG_4385.resized (set META).jpg                          47,653
IMG_4385.resized - stripped.jpg                          44,373
Stripper.exe                                             88,426

I used this tool to strip metadata from the files and saw that it did make a difference on the file size. The stripped files are smaller, than the SET META * files. Also the preview for them is different as well.

So DOPUS's SET META * command doesn't actually remove the full header, just replaces fields with blank values. Is it possible to have a command to REMOVE metadata? e.g. SET META REMOVE/DELETE

Currently it can be done with the help of an external tool, but that means spending the time to customize and create that option. Anyway, just a thought that it would be a nice to have feature. Ideally the make Thumbnails menu item should also do the same and strip the metadata. This is the default behavior in imagemagick, and it is especially useful as it can reduce the size drastically for small files! (an 18KB thumbnail can easily become just 8KB)
Anyway, not really important, just a nice to have option.

That was discussed recently in Clear EXIF metadata from images.