VerticalResolution

Jpeg2000Image.VerticalResolution property

获取或设置此对象的垂直分辨率,以每英寸像素为单位RasterImage .

public override double VerticalResolution { get; set; }

适当的价值

垂直分辨率。

评论

注意默认情况下这个值总是96,因为不同的平台不能返回屏幕分辨率。您可以考虑使用 SetResolution 方法在单个调用中更新两个分辨率值。

例子

以下示例显示如何设置 JPEG2000 图像的水平/垂直分辨率。

[C#]

string dir = "c:\\temp\\";

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.jp2"))
{
    Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image jpeg2000Image = (Aspose.Imaging.FileFormats.Jpeg2000.Jpeg2000Image)image;

    // 获取 Jpeg2000Image 的水平和垂直分辨率。
    double horizontalResolution = jpeg2000Image.HorizontalResolution;
    double verticalResolution = jpeg2000Image.VerticalResolution;
    System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", horizontalResolution);
    System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", verticalResolution);

    if (horizontalResolution != 96.0 || verticalResolution != 96.0)
    {
        // 使用 SetResolution 方法在一次调用中更新两个分辨率值。
        System.Console.WriteLine("Set resolution values to 96 dpi");
        jpeg2000Image.SetResolution(96.0, 96.0);

        System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", jpeg2000Image.HorizontalResolution);
        System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", jpeg2000Image.VerticalResolution);
    }
}

也可以看看