Full disclosure: I've never used ImageMagick. However, as previously stated in my comment, executables must be called correctly ...
PowerShell Running Executables
A quick search using...
'PowerShell ImageMagick'
... provides this sample of how to run the external executable via Powershell, as detailed in the MS link above. Based on what you posted, you won't need all of it. Just the convert section. Yet, it still must be all on one line.
PowerShell ImageMagick
# Windows Powershell Wrapper Script for ImageMagick
cls
$inputPath = "e:\Photos\ToResize\"
$targetPath = "e:\Photos\Resized\"
$files = get-ChildItem $inputPath
foreach ($file in $files)
{
#$output = & magick identify e:\Photos\ToResize2cca60-a2a9-49b8-964e-b228acf517f3.jpg
# shell out to run the ImageMagick "identify" command
$output = & magick identify $file.FullName
$outFilename = $targetPath + $file.Name
# sample value of $output:
#e:\Photos\ToResize2cca60-a2a9-49b8-964e-b228acf517f3.jpg JPEG 768x512 768x512+0+0 8-bit sRGB 111420B 0.000u 0:00.000
write-host $output
$pattern = ".* (\d*?)x(\d*?) .*"
#the first parenthese is for capturing the cityState into the $Matches array
#the second parentheses are needed above to look for $ (which is end of line)
#or zip code following the city/state
$isMatch = $output -match $pattern
if ($Matches.Count -gt 0)
{
#$width = $Matches[1];
#$height = $Matches[2];
[int]$width = [convert]::ToInt32($Matches[1]);
[int]$height = [convert]::ToInt32($Matches[2]);
if ($height -gt $width)
{
$orientation = "tall";
# shell out to run the ImageMagick "convert" command
& convert -define jpeg:size=510x510 $file.FullName -thumbnail "510x510>" -background white -gravity center -extent "510x510" $outFilename
}
else
{
$orientation = "wide";
# shell out to run the ImageMagick "convert" command
& convert -resize 510x510^ $file.FullName $outFilename
}
Write-Host ("file=$($file.name) width=$width height=$height orientation=$orientation `n`n");
}
else
{
Write-Host ("No matches");
}
}
So, your command as per the MS link and the sample posted would be something link this...
& convert "D:\3.jpg" ^ ( -size 1000x600 -background white -fill black -gravity center -font IM-FELL-English-Roman label:"TERRAZO\nPATTERN" ^ -bordercolor white -border 20 -bordercolor black -border 20 -bordercolor white -border 50 ) ^ ( +clone -fill "gray(15%)" -colorize 100 -virtual-pixel white -blur 0x40 -level 0x50% ) ^ ( -clone 1 -shave 40x40 -clone 2 +swap -gravity center -compose over -composite ) ^ -delete 1,2 ^ -gravity center -compose over -composite "D:\result.jpg"
Yet, again, I don't use this product, so this convert.exe specific syntax still may be problematic (since I cannot test this for validation) as if reflects that way in the ISE/VSCode.