Convert multipage TIFF to PNG .Net

前端 未结 4 2134
心在旅途
心在旅途 2020-12-15 13:40

I am able to convert a single page TIFF to a PNG in .Net, however, how would I do this for a multipage TIFF?

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-15 13:44

    Imagemagick can do just about anything with images but it might take a while to get it right due to the overwhelming amount of options to choose from. You can use interop to work directly with Imagemagick or you can use a .NET wrapper. I have only used interop so I don't know how good or bad the wrapper is.

    private readonly ImageMagickObject.MagickImageClass _imageMagick = new ImageMagickObject.MagickImageClass();
    
    var parameters = new object[] {sourcePath, destPath};
    _imageMagick.Convert(ref parameters);
    

    The parameters you'll have to find out for yourself on the ImageMagick website. Look at the help for the command line parameter and search the forum for multipage tiff. I assume you want to split the tiff into multiple pngs? Then maybe something like this:

    convert multipage.tif single%d.png

提交回复
热议问题