asp.net

位置:IT落伍者 >> asp.net >> 浏览文章

asp.net如何获取图片的分辨率


发布日期:2020年07月27日
 
asp.net如何获取图片的分辨率

public void formatImage()

{

//格式化后的图片大小

int _WIDTH = ;

int _HEIGHT = ;

SystemDrawingImageGetThumbnailImageAbort myCallback = new SystemDrawingImageGetThumbnailImageAbort(ThumbnailCallback);

SystemDrawingImage img = SystemDrawingImageFromFile(@d:\png);

//制作缩略图

int width = imgWidth;

int height = imgHeight;

double divide = (double)height / (double)width;

if (width > _WIDTH || height > _HEIGHT)

{

if (width > _WIDTH)

{

height = ConvertToInt(MathFloor(_WIDTH * divide));

width = _WIDTH;

}

if (height > _HEIGHT)

{

width = ConvertToInt(MathFloor(_HEIGHT / divide));

height = _HEIGHT;

}

SystemDrawingImage timg = imgGetThumbnailImage(width height myCallback SystemIntPtrZero);

timgSave(@d:\jpg SystemDrawingImagingImageFormatJpeg);

//下面的是保存到流中

//MemoryStream ms = new MemoryStream();

//timgSave(ms SystemDrawingImagingImageFormatJpeg);

//msClose();

}

}

public bool ThumbnailCallback()

{

return false;

}

上一篇:各种ASP.NET定时执行任务解决方案收集

下一篇:Asp.net中创建Auto Complete Text Box&n