Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 网站建设 > ASP.NET > ASP adodb.stream 取 .png 图片完整文件头信息 By shawl.qiu
【标  题】:ASP adodb.stream 取 .png 图片完整文件头信息 By shawl.qiu
【关键字】:ASP,adodb.stream,.png,By,shawl.qiu
【来  源】:http://blog.csdn.net/btbtd/archive/2006/09/17/1232943.aspx

ASP adodb.stream 取 .png 图片完整文件头信息 By shawl.qiu

Your Ad Here

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
  1. <%
  2.     dim file:file=server.MapPath("a.png")
  3.     dim temp
  4.     dim stm
  5.     set stm=createObject("adodb.stream")
  6.         with stm
  7.             .type = 1
  8.             .open
  9.             .loadFromFile file
  10.             temp=.read
  11.             .close
  12.         end with    
  13.     set stm=nothing
  14.         response.write "png file info:<br/>"
  15.         response.write "<br/>#2-4/3 Header Signature: "&binToStr(midB(temp,2,3))
  16.         response.write "<br/>#12-16/4 First chunk(IHDR): "&binToStr(midB(temp,12,5))
  17.         response.write "<br/>#17-20/4 Width: "&binToNumPng(midB(temp,17,4))
  18.         response.write "<br/>#21-24/4 Height: "&binToNumPng(midB(temp,21,4))
  19.         response.write "<br/>#25-25/1 Bit depth: "&binToNumPng(midB(temp,25,1))
  20.         response.write "<br/>#26-26/1 ColorType: "&binToNumPng(midB(temp,26,1))
  21.         response.write "<br/>#27-27/1 Compression method: "&binToNumPng(midB(temp,17,1))
  22.         response.write "<br/>#28-28/1 Filter method: "&binToNumPng(midB(temp,28,1))
  23.         response.write "<br/>#29-29/1 Interlace method: "&binToNumPng(midB(temp,29,1))
  24.  
  25.     private function binToNumPng(bin)
  26.     '二进制转为 Numeric (png)
  27.         dim i:binToNumPng=0
  28.         for i=1 to lenB(bin)
  29.             binToNumPng=binToNumPng*256+ascB(midB(bin,i,1))
  30.         next 'shawl.qiu'
  31.     end function
  32.     
  33.     private function binToStr(bin)
  34.     '二进制转为 string (bmp|gif|png)
  35.         dim i, iByt, sByt, bLen:bLen=lenB(bin)
  36.         for i=1 to bLen
  37.             sByt=midB(bin,i,1):iByt=ascB(sByt)
  38.             if iByt<128 then
  39.                 binToStr=binToStr&chr(iByt)
  40.             else:i=i+1
  41.                 if i<=bLen then binToStr=binToStr&chr(ascW(sByt&sByt))
  42.             end if
  43.         next 'shawl.qiu'
  44.     end function
  45. %>

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


附: 测试图片 
gi_photo

《Ruby vs. Python性能测试报告》(附单词频率统计实例):【上一篇】
[比较编程]Sorting in Ruby and Python:【下一篇】
【相关文章】
  • 《Ruby vs. Python性能测试报告》(附单词频率统计实例)
  • asp制作显IP图片
  • rubychina.org
  • By The Community, For the Community 终于发布了!
  • Starter Kit for ASP.NET 2.0 家族又添新丁!
  • asp.net控件开发基础(10)
  • ASP教程
  • ASP实现上传文件功能
  • 10天学会ASP.NET
  • ASP adodb.stream 取 Win32 .bmp 图片完整文件头信息 By shawl.qiu
  • 【随机文章】
  • ISA Server 2006 新特性介绍
  • J2EE架构下系统设计模式
  • 从香山衡器的K/3成功应用看中国企业管理软件的实施
  • PHP的FTP学习(四) 
  • vim的用法[转载]
  • 用网易网络精灵打造最炫个人电台
  • 复合电子商务
  • Access使用宏控制程序--1.5一个宏的实例——检验口令
  • 32位10/100M免线笔记本网卡PCM200
  • Linux下的代理服务器设置
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.