Button to remove metadata and convert image

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