【发布时间】:2014-07-10 00:25:32
【问题描述】:
如何在 C# 中计算基于百万像素的精确分辨率?
假设我有一个 5000x4000 像素的图像,我想重新缩放到 0.6mpx,我怎样才能获得精确的水平和垂直分辨率来获得 0.6mpx 的图像并保持原始纵横比?
我有这个:
int nXPixels=5000; // original image Width
int nYPixels=4000; // original image Height
float fRatio=5000/4000; // original image aspect ratio
int nNewPixelResolution=600000; // 0.6mpx new resolution
int nNewXPixels=?
int nNewYPixels=?
【问题讨论】:
-
这个问题的答案是在 2 秒的 Google 搜索中找到的:math.stackexchange.com/questions/180804/…
-
@durbnpoisn 不是;没有提到任何关于面积(或百万像素)的内容。
-
实际上@durbnpoisn,您的链接没有提供答案。 OP 希望指定输出 MegaPixels(wxh 的总像素)而不是输出宽度或高度。
标签: c# image resolution