Author Topic: Call ImageMagick to convert file format  (Read 9631 times)

dennys

  • Newbie
  • *
  • Posts: 1
    • View Profile
Call ImageMagick to convert file format
« on: January 28, 2023, 16:14:17 »
Hi, I try to add a custom context menu to call ImageMagick to convert file format.

1. I try to call ImageMagick directly and it works (because ImageMagick shows lots of help, I can see it), and this is my script
MC.Run CMD="D:\ImageMagick\convert.exe"

2. I try to add parameters to generate a command like this "D:\ImageMagick\convert.exe filename.jpg filename.webp", but it doesn't work.
MC.Run CMD="D:\ImageMagick\convert.exe" ARG="${sourcefocusname} PathGetNamePart( ${sourcefocusname}, 1).webp ";

And I try to change the log level of the application log to debug / Full, but it doesn't show anything.
Can you advice how to debug?

Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 537
  • Old Skull
    • View Profile
Re: Call ImageMagick to convert file format
« Reply #1 on: January 28, 2023, 17:46:24 »
2. Menu Help > MultiScript debugger...

1. I'm almost sure that PathGetNamePart( ${sourcefocusname}, 1).webp will not work inside ARG="...". I think you would need to write something like
Code: [Select]
@var $path = GetSourceFocusPath();
@var $new_name = GetSourcePath() ^ PathGetNamePart( $path, 1 ) + ".webp";

MC.Run CMD="D:\ImageMagick\convert.exe" ARG="${focusfilepath} ${new_name}";