第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

使用Graphics 保存 圖片質(zhì)量很差,怎么回事?

使用Graphics 保存 圖片質(zhì)量很差,怎么回事?

喵喵時(shí)光機(jī) 2018-12-07 04:11:23
原本寬度為300 的圖片ImagePhoto 大小為 30KB FixedSize(ImagePhoto,300) 之后 圖片 變?yōu)?20KB 了,圖片質(zhì)量下降了很多 怎么弄讓圖片質(zhì)量和原來的一樣呢? public static Image FixedSize(Image imgPhoto, int Width) { int sourceWidth = imgPhoto.Width; int sourceHeight = imgPhoto.Height; int w, h; if (sourceWidth > Width) { decimal nPercent = (decimal)sourceWidth / Width; w = Width; h = (int)Math.Round((decimal)sourceHeight / nPercent, 0); } else { w = sourceWidth; h = sourceHeight; } Bitmap bmPhoto = new Bitmap(w, h, imgPhoto.PixelFormat); bmPhoto.SetResolution(imgPhoto.HorizontalResolution, imgPhoto.VerticalResolution); Graphics grPhoto = Graphics.FromImage(bmPhoto); grPhoto.CompositingQuality = CompositingQuality.HighQuality; grPhoto.SmoothingMode = SmoothingMode.HighQuality; grPhoto.InterpolationMode = InterpolationMode.HighQualityBicubic; grPhoto.DrawImage(imgPhoto, new Rectangle(0, 0, w, h), new Rectangle(0, 0, sourceWidth, sourceHeight), GraphicsUnit.Pixel); grPhoto.Dispose(); return bmPhoto; }
查看完整描述

1 回答

?
斯蒂芬大帝

TA貢獻(xiàn)1827條經(jīng)驗(yàn) 獲得超8個(gè)贊

如果是JPG的話,參考以下代碼:

var imageCodeInfo = GetEncoderInfo("image/jpeg");
var myEncoder = System.Drawing.Imaging.Encoder.Quality;
var myEncoderParameters = new EncoderParameters(1);
var myEncoderParameters.Param[0] = new EncoderParameter(myEncoder, 99L);
thumbNail.Save(thumbUrl, imageCodeInfo, myEncoderParameters);
查看完整回答
反對(duì) 回復(fù) 2019-01-21
  • 1 回答
  • 0 關(guān)注
  • 1183 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)