Tag: 裁剪的

最佳resize和/或裁剪逻辑

我曾经遇到过这几次,并认为把它放在那里会很好。 什么是你最好的图像resize和/或裁剪逻辑。 想法是使用目标图像,尺寸和裁剪标记调用某些方法 – 这将返回或保存或任何所需图像。 我的下面。 从VB转换为C#所以是的,会有小错误,但逻辑是我们正在看的。 // INIT // On/off bool WeAreCropping = true; // Get some dimensions int TargetWidth = RequestedWidth; int TargetHeight = RequestedHeight; int SourceWidth = SourceImage.Width; int SourceHeight = SourceImage.Height; int ResizeWidth = TargetWidth; int ResizeHeight = TargetHeight; // GET RESIZE VALUES // Are we cropping? if (WeAreCropping) { // […]