0

我正在使用 MagickImage 更改图像的 Dpi,但它不起作用

MagickNET.SetGhostscriptDirectory(System.IO.Directory.GetCurrentDirectory());
        MagickReadSettings settings = new MagickReadSettings();
        settings.Density = new Density(72, 72);
        using (MagickImage image = new MagickImage(@"C:\Users\User\AppData\Local\Temp\Chapter 4\Figure 4-1.tif", settings))
        {
            image.Write(@"C:\Users\User\AppData\Local\Temp\Chapter 4\Figure 4-1.jpg");
        }

或者如果这不起作用

有没有办法像Photoshop一样调整图像大小

example the image with 300 dPi have a w1200xh788 size

and using photoshop. i changed the dpi to 72 and it creates a w288xh189

我怎么能以编程方式做到这一点。谢谢你

4

1 回答 1

0

您可以执行以下操作:

using System;

    namespace ImageDPI
    {
        public class Program
        {
            public static void Main(string[] args)
            {
                int Aw, Ah, Rw, Rh, Adpi, Rdpi;

                Aw = 1200;
                Ah = 788;

                Adpi = 300;
                Rdpi = 72;

                Rw= (Aw * Rdpi) / Adpi;
                Rh= (Ah * Rdpi) / Adpi;

                Console.WriteLine(Rw);
                Console.WriteLine(Rh);


            }
        }
    }
于 2016-09-27T07:45:00.037 回答