【发布时间】:2017-03-10 05:25:13
【问题描述】:
在我的 xamarin.mac 应用程序中,我使用 SQLite 保存数据库,个人资料图片也保存在数据库中,但我在处理大图像时遇到问题(例如大小 4 MB),我上传时只需要保存照片的缩略图:
imgProfilePicture.Image = new NSImage (path);
Byte [] bytes = System.IO.File.ReadAllBytes (path);
_profilePic = Convert.ToBase64String (bytes);
我将 base64 字符串保存在 db.. 中,here 是 c# 中的简单解决方案:
Image image = Image.FromFile(fileName);
Image thumb = image.GetThumbnailImage(120, 120, ()=>false, IntPtr.Zero);
thumb.Save(Path.ChangeExtension(fileName, "thumb"));
我需要这样的东西,需要在不裁剪的情况下调整图像大小
【问题讨论】:
标签: c# cocoa thumbnails nsimage xamarin.mac