ASP adodb.stream 取 .png 图片完整文件头信息 By shawl.qiu
2006-09-17 17:52
906 查看
ASP adodb.stream 取 .png 图片完整文件头信息 By shawl.qiu
摘要:主要目的为取 .png文件 的高宽度信息, 使用ASP完成(不用外建组件).
进一步了解请查看相关文章.
作用:
本文使用 ASP 的内置组件 adodb.stream 取得 .png 的头部信息, 包括高宽度信息.
相关文章:
1. ASP adodb.stream 取 Win32 .bmp 图片完整文件头信息 By shawl.qiu
URL: http://blog.csdn.net/btbtd/archive/2006/09/16/1228908.aspx
2. ASP adodb.stream 取 .gif 图片完整文件头&描述信息 By shawl.qiu
URL: http://blog.csdn.net/btbtd/archive/2006/09/17/1232530.aspx
目录:
1. 主内容: 完整例子
2. 参考文献
3. 预览
附: 测试图片
shawl.qiu
2006-09-17
http://blog.csdn.net/btbtd/
1. 主内容: 完整例子
linenum
<%
dim file:file=server.MapPath("a.png")
dim temp
dim stm
set stm=createObject("adodb.stream")
with stm
.type = 1
.open
.loadFromFile file
temp=.read
.close
end with
set stm=nothing
response.write "png file info:<br/>"
response.write "<br/>#2-4/3 Header Signature: "&binToStr(midB(temp,2,3))
response.write "<br/>#12-16/4 First chunk(IHDR): "&binToStr(midB(temp,12,5))
response.write "<br/>#17-20/4 Width: "&binToNumPng(midB(temp,17,4))
response.write "<br/>#21-24/4 Height: "&binToNumPng(midB(temp,21,4))
response.write "<br/>#25-25/1 Bit depth: "&binToNumPng(midB(temp,25,1))
response.write "<br/>#26-26/1 ColorType: "&binToNumPng(midB(temp,26,1))
response.write "<br/>#27-27/1 Compression method: "&binToNumPng(midB(temp,17,1))
response.write "<br/>#28-28/1 Filter method: "&binToNumPng(midB(temp,28,1))
response.write "<br/>#29-29/1 Interlace method: "&binToNumPng(midB(temp,29,1))
private function binToNumPng(bin)
'二进制转为 Numeric (png)
dim i:binToNumPng=0
for i=1 to lenB(bin)
binToNumPng=binToNumPng*256+ascB(midB(bin,i,1))
next 'shawl.qiu'
end function
private function binToStr(bin)
'二进制转为 string (bmp|gif|png)
dim i, iByt, sByt, bLen:bLen=lenB(bin)
for i=1 to bLen
sByt=midB(bin,i,1):iByt=ascB(sByt)
if iByt<128 then
binToStr=binToStr&chr(iByt)
else:i=i+1
if i<=bLen then binToStr=binToStr&chr(ascW(sByt&sByt))
end if
next 'shawl.qiu'
end function
%>
2. 参考文献
PNG File Format Summary
URL: http://www.fileformat.info/format/png/
3. 预览
png file info:
#2-4/3 Header Signature: PNG
#12-16/4 First chunk(IHDR): IHDR
#17-20/4 Width: 120
#21-24/4 Height: 146
#25-25/1 Bit depth: 8
#26-26/1 ColorType: 3
#27-27/1 Compression method: 0
#28-28/1 Filter method: 0
#29-29/1 Interlace method: 0
附: 测试图片
相关文章推荐
- ASP adodb.stream 取 Win32 .bmp 图片完整文件头信息 By shawl.qiu
- ASP adodb.stream 取 .gif 图片完整文件头&描述信息 By shawl.qiu
- ASP adodb.stream 取 .jpg 图片高宽度 By shawl.qiu
- ASP Adodb.Stream 上传文件到服务器硬盘, 详细注解 By shawl.qiu
- ASP 二进制与字符串互转, 另类完美解决方法, adodb.stream 实现 By shawl.qiu
- ASP CDO.Message 发送邮件完整实例 By shawl.qiu
- 获取远程服务器数据(asp,adodb.stream,保存远程图片,XMLHTTP)
- ASP VBScript 动态包含文件, FSO 实现 By Shawl.qiu
- ASP Class(类) 之 使用内建组件 cdo.message 发送邮件 By shawl.qiu
- 在 Access 里使用查询建立 存储过程/视图, 并使用 ASP 执行 By shawl.qiu
- ASP + Access 初阶笔记 By Shawl.qiu
- 用ASP VBS xmlhttp adodbstream下载和保存图片的代码
- ASP [a-zA-Z0-9]无错N长度随机数函数 By shawl.qiu
- ASP 技巧一则之 简化创建关闭记录集对象并创建使用简单的MSSQL存储过程 By shawl.qiu
- ASP + mssql 与 查询分析器 之 使用存储过程 建,添,更,选,删 基本数据操作 By shawl.qiu
- asp.net 中 使用 ado 的 Recordset GetString 函数 By shawl.qiu
- asp上传图片提示 ADODB.Stream 错误 '800a0bbc'的解决方法
- ASP ADO getRows() 使用演示 By shawl.qiu
- ASP 优化之显示数据查询内容 By shawl.qiu
- ASP 初阶笔记 By Shawl.qiu