-
ASP adodb.stream 取 .gif 图片完整文件头&描述信息 By shawl.qiu
摘要:
主要是想 用 ASP 取 .gif 的高宽度(不用外建组件), 不过既然要了解, 也就了解多一点.
GIF 的头部信息并不包括高宽度, 但接下去的逻辑画面描述就有包括高宽度信息.
作用:
本文使用 ASP 的内置组件 adodb.stream 取得 .gif 的头部信息和高宽信息.
附: 相关文章
ASP adodb.stream 取 Win32 .bmp 图片完整文件头信息 By shawl.qiu
URL: http://blog.csdn.net/btbtd/archive/2006/09/16/1228908.aspx
目录:
1. 主内容: 完整例子
2. 参考文献
3. 预览
附: 测试图片
shawl.qiu
2006-09-17
http://blog.csdn.net/btbtd
1. 主内容: 完整例子
- linenum
- <%
- dim file:file=server.MapPath("a.gif")
- 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 "gif file info:<br/>"
- response.write "<br/>#1-3/3 Header Signature: "&binToStr(midB(temp,1,3))
- response.write "<br/>#4-6/3 GIF format version(""87a"" or ""89a""): "&binToStr(midB(temp,4,3))
- response.write "<br/>#7-8/2 Width of Display Screen in Pixels: "&binToNum(midB(temp,7,2))
- response.write "<br/>#9-10/2 Height of Display Screen in Pixels: "&binToNum(midB(temp,9,2))
- response.write "<br/>#11-11/1 BYTE Packed: "&binToNum(midB(temp,11,1))
- response.write "<br/>#12-12/1 BYTE BackgroundColor: "&binToNum(midB(temp,12,1))
- response.write "<br/>#13-13/1 BYTE AspectRatio: "&binToNum(midB(temp,13,1))
- private function binToNum(bin)
- '二进制转为 Numeric
- dim i:binToNum=0
- for i=lenB(bin) to 1 step -1
- binToNum=binToNum*256+ascB(midB(bin,i,1))
- next 'shawl.qiu code'
- end function
- private function binToStr(bin)
- '二进制转为 string
- 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. 参考文献
2.1 Description of logical screen in file GIF
http://semmix.pl/color/exgraf/eeg13.htm
2.2 GIF File Format Summary
http://www.fileformat.info/format/gif/
3. 预览
-
gif file info:
#1-3/3 Header Signature: GIF
#4-6/3 GIF format version("87a" or "89a"): 89a
#7-8/2 Width of Display Screen in Pixels: 150
#9-10/2 Height of Display Screen in Pixels: 109
#11-11/1 BYTE Packed: 247
#12-12/1 BYTE BackgroundColor: 233
#13-13/1 BYTE AspectRatio: 0
附: 测试图片
ASP adodb.stream 取 .gif 图片完整文件头&描述信息 By shawl.qiu
最新推荐文章于 2024-10-02 18:18:11 发布