Button to remove metadata and convert image

Hi,

i have this button for image conversion:

 @runmode:hide
Image CONVERT=jpg WIDTH=1500 HEIGHT=1500 ADDSUFFIX=_1500px NOENLARGE PRESERVEASPECTRATIO TO ".........." QUALITY=90

What do I have to add to that Button, to delete all identifiable Meta-/Exifdata?

Thank you!

SetAttr META *

https://docs.dopus.com/doku.php?id=file_operations:editing_metadata:programmatic_setting_of_metadata

1 Like

If I want to really guarantee no metadata is carried over, I like to convert to BMP and then convert that to JPG (or whichever target format is desired).

That would ensure that even metadata Opus doesn't know about is not carried over.

I do the same with other conversion tools, so this is not specific to Opus. There are so many metadata formats that different things may attach to a file, some specific to that software and not used by anything else. Converting to a format that can't contain any metadata is a good way to ensure none* of it is kept.

JPEG embedded thumbnails are a good example. Most software ignores them these days but that also means they're rarely updated when the image is edited. I've seen JPGs where the thumbnail revealed an older / alternative version of the actual image. (The Windows desktop used to display those thumbnails. Not sure if it still does. But that was how I noticed it on a file someone sent me. Very confusing at first as an entire element of the image was missing in the version I saw on my desktop!)

(* Aside from some kind of steganographic encoding in the image data itself, of course.)

3 Likes

Can I somehow combine this in one Action/Button, with the rest of my conversion? If so, would you write the script for me?

 @runmode:hide
Image CONVERT=bmp CONVERT=jpg WIDTH=1500 HEIGHT=1500 ADDSUFFIX=_1500px NOENLARGE PRESERVEASPECTRATIO TO ".........." QUALITY=90

I would use a small script:

Edit the OutputDir line at the top to specify the folder you want. (I'm assuming .......... was a placeholder, not the actual path you want.) Remember to double backslashes in that path.

function OnClick(clickData)
{
	// Remember to double backslashes in paths.
	var OutputDir = "C:\\My Output Folder";

	var BmpArgs = "WIDTH=1500 HEIGHT=1500 ADDSUFFIX=_1500px NOENLARGE PRESERVEASPECTRATIO";
	var JpgArgs = "QUALITY=90";

	var TempDir = DOpus.FSUtil.GetTempDirPath();
	if (DOpus.TypeOf(TempDir) != "object.Path")
		return;
	
	var cmd = clickData.func.command;

	cmd.RunCommand('Image CONVERT=bmp TO="' + TempDir + '" ' + BmpArgs);
	cmd.ClearFiles();
	cmd.RunCommand('Image CONVERT=jpg FROM="' + TempDir + '\\*.bmp" TO="' + OutputDir + '" ' + JpgArgs);

	// Our temp dir will be deleted automatically after a few minutes, but we may as well clean it up now.
	cmd.RunCommand('Delete QUIET NORECYCLE FILE="' + TempDir + '"');
}
2 Likes

It works like a charm. Thank you!

1 Like