下面两个文件: <!--#include virtual="/intels/chunfeng/graphicdetect.asp"--> <html> <head> <TITLE>图像尺寸</TITLE> </head> <body bgcolor="#FFFFFF"> <% graphic="images/intels.gif" HW = ReadImg(graphic) Response.Write graphic & " Dimensions: " & HW(0) & "x" & HW(1) & "<br>" response.write "<img src=""/" & graphic & """" response.write height=""" & HW(0) & """ response.write width=""" & HW(0) & "">" %> </body> </html>
------------------------ graphicdetect.asp <% Dim HW
Function AscAt(s, n) AscAt = Asc(Mid(s, n, 1)) End Function
Function HexAt(s, n) HexAt = Hex(AscAt(s, n)) End Function
Function isJPG(fichero) If inStr(uCase(fichero), ".JPG") <> 0 Then isJPG = true Else isJPG = false End If End Function
Function isPNG(fichero) If inStr(uCase(fichero), ".PNG") <> 0 Then isPNG = true Else isPNG = false End If End Function
Function isGIF(fichero) If inStr(uCase(fichero), ".GIF") <> 0 Then isGIF = true Else isGIF = false End If End Function
Function isBMP(fichero) If inStr(uCase(fichero), ".BMP") <> 0 Then isBMP = true Else isBMP = false End If End Function
Function isWMF(fichero) If inStr(uCase(fichero), ".WMF") <> 0 Then isWMF = true Else isWMF = false End If End Function
Function isWebImg(f) If isGIF(f) Or isJPG(f) Or isPNG(f) Or isBMP(f) Or isWMF(f) Then isWebImg = true Else isWebImg = true End If End Function
Function ReadImg(fichero) If isGIF(fichero) Then ReadImg = ReadGIF(fichero) Else If isJPG(fichero) Then ReadImg = ReadJPG(fichero) Else If isPNG(fichero) Then ReadImg = ReadPNG(fichero) Else If isBMP(fichero) Then ReadImg = ReadPNG(fichero) Else If isWMF(fichero) Then ReadImg = ReadWMF(fichero) Else ReadImg = Array(0,0) End If End If End If End If End If End Function
Function ReadJPG(fichero) Dim fso, ts, s, HW, nbytes HW = Array("","") Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.OpenTextFile(Server.MapPath("/" & fichero), 1) s = Right(ts.Read(167), 4) HW(0) = HexToDec(HexAt(s,3) & HexAt(s,4)) HW(1) = HexToDec(HexAt(s,1) & HexAt(s,2)) ts.Close ReadJPG = HW End Function
Function ReadPNG(fichero) Dim fso, ts, s, HW, nbytes HW = Array("","") Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.OpenTextFile(Server.MapPath("/" & fichero), 1) s = Right(ts.Read(24), 8) HW(0) = HexToDec(HexAt(s,3) & HexAt(s,4)) HW(1) = HexToDec(HexAt(s,7) & HexAt(s,8)) ts.Close ReadPNG = HW End Function
Function ReadGIF(fichero) Dim fso, ts, s, HW, nbytes HW = Array("","") Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.OpenTextFile(Server.MapPath("/" & fichero), 1) s = Right(ts.Read(10), 4) HW(0) = HexToDec(HexAt(s,2) & HexAt(s,1)) HW(1) = HexToDec(HexAt(s,4) & HexAt(s,3)) ts.Close ReadGIF = HW End Function
Function ReadWMF(fichero) Dim fso, ts, s, HW, nbytes HW = Array("","") Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.OpenTextFile(Server.MapPath("/" & fichero), 1) s = Right(ts.Read(14), 4) HW(0) = HexToDec(HexAt(s,2) & HexAt(s,1)) HW(1) = HexToDec(HexAt(s,4) & HexAt(s,3)) ts.Close ReadWMF = HW End Function
Function ReadBMP(fichero) Dim fso, ts, s, HW, nbytes HW = Array("","") Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.OpenTextFile(Server.MapPath("/" & fichero), 1) s = Right(ts.Read(24), 8) HW(0) = HexToDec(HexAt(s,4) & HexAt(s,3)) HW(1) = HexToDec(HexAt(s,8) & HexAt(s,7)) ts.Close ReadBMP = HW End Function
Function isDigit(c) If inStr("0123456789", c) <> 0 Then isDigit = true Else isDigit = false End If End Function
Function isHex(c) If inStr("0123456789ABCDEFabcdef", c) <> 0 Then isHex = true Else ishex = false End If End Function
Function HexToDec(cadhex) Dim n, i, ch, decimal decimal = 0 n = Len(cadhex) For i=1 To n ch = Mid(cadhex, i, 1) If isHex(ch) Then decimal = decimal * 16 If isDigit(c) Then decimal = decimal + ch Else decimal = decimal + Asc(uCase(ch)) - Asc("A") End If Else HexToDec = -1 End If Next HexToDec = decimal End Function %>
|
相关推荐
ASP技术问题解答,希望对你有帮助。
能够实现简单得图像目标尺寸测量,已经发表过EI证实可靠性
基于Matlab的图像物体实际尺寸检测系统.zip
【图像检测】基于形态学实现图像目标尺寸测量系统附matlab代码 上传版本.zip
matlab开发-尺寸检测图像。检测由CMOS图像传感器拍摄的图像中的任何异物。
图像旋转与尺寸不变性图像旋转与尺寸不变性图像旋转与尺寸不变性
载入任意图像,在图像上自由选取任意两点,自动测量图像的像素距离(pixel)和进行实际距离(mm)的转换程序,C#写的,导入VS项目中直接运行可见效果。
python3实现对批量图像的尺寸进行设置,并且可实现图像中任意尺寸的裁剪。
CodeIgniter高级图像,先进的图像尺寸调整/裁剪控制器,可根据预设尺寸即时调整图像尺寸。
VC++ 获取BMP图像的尺寸大小 VC++图像操作实例,获取BMP图像的尺寸大小,注意这里不是获取的占用字节,是像素,你随便载入一个BMP位图,点击“获取大斜按钮,BMP的长度和宽度会显示出来,这是个很简单的图像基础操作...
针对传统接触式尺寸测量方法的缺点,探讨利用数字图像处理技术进行几何尺寸测量的方法,为产品的尺寸测量提供实时、快速、有效、经济的测量途径.给出了利用数字图像处理技术进行非接触式尺寸测量的方法,它包括图像...
其次,利用CCD相机采集待检刹车片图像以及进行滤波、二值化处理,得到二值图像并利用最小外接矩形优化算法确定其放缩倍数,得到与标准模板图相同的像素尺寸标准的实际图;最后利用实际图与标准模板图两圆心坐标连线...
Delph图像字符尺寸精确
异步装载大尺寸图像文件
图像处理,灰度变换,中值滤波,二值化处理,边缘检测,一维尺寸测量
基于图像的车辆外型尺寸识别技术研究,胡永举,,本文结合对超限车辆的治理工作,提出了可用于车辆外廓尺寸识别的图像标定处理技术方法,该方法运算简便,运算速度和精度可达到现
本代码用于以一定的重叠比例裁剪大尺寸图片为等尺寸的小尺寸图片集,适用场景为深度学习目标检测等
TinyPic 是一款采用简单地拖拽一个或者多个图像到其界面上,用于重新设置图像尺寸的简单但高效的工具。该软件设计用于那些对图像重新设置尺寸和压缩等级不熟悉的用户,并且该软件是基本地傻瓜操作。你可以在三种不同...