PowerShell and Magick.NET Write performance advice

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
Batman11
Posts: 1
Joined: 2019-04-02T17:24:57-07:00
Authentication code: 1152

PowerShell and Magick.NET Write performance advice

Post by Batman11 »

Hi, Using .NEt and PowerShell, I'm trying to write a rectangle on a bunch of small Tif images (each size around 10k). Seems to be working except performance is slow when saving the Tif image to disk (Using $IMG.WRITE). It takes about half a second or more to write it out. Was hoping to bring this down a bit.
Any advice on increasing performance of the write? Thanks

Code: Select all

GCI "C:\users\Allan\desktop\\images" | ForEach-Object {

    $img = [ImageMagick.MagickImage]::new($_)

    $Draw = [ImageMagick.Drawables]::new()
    $Draw.FillColor([ImageMagick.MagickColors]::Blue)
    
    $draw.Rectangle(0,0,780,245)}
    
    $Draw.Draw($img)
    
   $FileOut ="C:\users\allan\desktop\images\x$_"
    $img.Write($FileOut)
 }
I measured the write command ($img.Write($FileOut)) and it takes around .7 of a second to write it out.
I'm trying other methods and they write at around .2 to .3 of a second. That doesn't sound like much but those processes already take about 2 hours to do.
Thanks
Post Reply