Search code examples
powershellimagemagickscaleimagemagick-convert

Looking for powershell solution to convert/scale tif images to jpeg


I want to re-scale TIFF images to JPEGs at 500 pixels across. My script below can convert .jpg into a scaled .jpg within a local drive but not across a server. What am I missing for it to work?

Get-ChildItem -path $source -filter *.tif | % { convert $_.Name -scale 500 "$($_.BaseName)-scaled.jpg" }

If I try to work across a network I get the error:

convert.exe: unable to open image "....jpg": No such file or directory

I also can't seem to convert .tif to .jpg in this way. Is there a way around both of these issues?


Solution

  • This is a partial solution:

    Get-ChildItem -path $source -filter *.tif | % { convert $_.FullName -scale 500 "$($_.BaseName)-scaled.jpg" }
    

    However, the rescaled images are placed where the ps1 script is located.