求一图片大小范围的计算 有一300*300的画布,上传后的图片进行等比压缩,压缩后的宽度最小是300,压缩后的高度最小是200。原图片限定的大小是小于等于1M的,那么原图的原始图片长宽应该符合什么条件呢;当然这里面有个分辨率的不同,暂以72/(像素/英寸)来考虑,拜谢了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 问的比较矛盾,不够清晰..."比如,如果宽>300高<200,则已宽300进行等比压缩到宽=300,高自适应,如果宽<300而高>200,则已高=200进行等比压缩(这两种压缩会导致一边小于原预期值,等比吗,不然就变形..)...然后在判断高>200切宽>300..........等等其他很多情况..."真不知道你这是什么意思....怎么像素也撤进来了... /// <summary> /// </summary> /// <param name="outCeshiPath">要压缩的图片的路径</param> /// <param name="converPhoto">压缩后保存路径</param> /// <res> /// </res> public static void CompressMinImage(string pPath, string outCeshiPath, string converPhoto) { int width = 300; int height = 200; Image img = Image.FromFile(outCeshiPath); int W = img.Width - width; int H = img.Height - height; if (img.Width >= 300&& img.Height >= 200) { Image originalImg = Image.FromFile(outCeshiPath); Bitmap bmpOut = new Bitmap(width, height, PixelFormat.Format24bppRgb); Graphics g = Graphics.FromImage(bmpOut); g.DrawImage(originalImg, new Rectangle(0, 0, width, height), new Rectangle(0, 0, width, height), GraphicsUnit.Pixel); bmpOut.Save(converPhoto, ImageFormat.Jpeg); originalImg.Dispose(); bmpOut.Dispose(); g.Dispose(); }else{ //xxxxxxxxxx } } 关于int重写的tostring()方法 数据缓存问题 如何判断来访问ip为搜索引擎蜘蛛? 有个疑难问题 关于客户下的单子 延迟5秒再判断该单子是否有效 如何用CSS来实现鼠标经过图像凸起? 調用函數的問題,急,解決即送分。 通过网值传递带“+”号的参数的问题 帮我看看我这是出了什么问题~(关于新闻图片轮换) 想做一个问题反馈的页面,当按下提交后将数据保存在数据库(SQL SERVER 2K) 新手求帮帮忙!关于文本输出的 请问如何实现下载文件到就地指定文件夹并一键下载服务器端某一文件夹下所有文件 html页面显示excel文件
"比如,如果宽>300高<200,则已宽300进行等比压缩到宽=300,高自适应,如果宽<300而高>200,则已高=200进行等比压缩(这两种压缩会导致一边小于原预期值,等比吗,不然就变形..)...然后在判断高>200切宽>300..........等等其他很多情况..."
真不知道你这是什么意思....怎么像素也撤进来了...
/// </summary>
/// <param name="outCeshiPath">要压缩的图片的路径</param>
/// <param name="converPhoto">压缩后保存路径</param>
/// <res>
/// </res>
public static void CompressMinImage(string pPath, string outCeshiPath, string converPhoto)
{
int width = 300;
int height = 200;
Image img = Image.FromFile(outCeshiPath);
int W = img.Width - width;
int H = img.Height - height;
if (img.Width >= 300&& img.Height >= 200)
{
Image originalImg = Image.FromFile(outCeshiPath);
Bitmap bmpOut = new Bitmap(width, height, PixelFormat.Format24bppRgb);
Graphics g = Graphics.FromImage(bmpOut);
g.DrawImage(originalImg, new Rectangle(0, 0, width, height), new Rectangle(0, 0, width, height), GraphicsUnit.Pixel);
bmpOut.Save(converPhoto, ImageFormat.Jpeg);
originalImg.Dispose();
bmpOut.Dispose();
g.Dispose();
}else{
//xxxxxxxxxx
} }