惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V2EX - 技术
V2EX - 技术
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Latest news
Latest news
T
The Exploit Database - CXSecurity.com
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
L
Lohrmann on Cybersecurity
aimingoo的专栏
aimingoo的专栏
B
Blog
T
Threat Research - Cisco Blogs
罗磊的独立博客
Application and Cybersecurity Blog
Application and Cybersecurity Blog
P
Proofpoint News Feed
P
Palo Alto Networks Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
宝玉的分享
宝玉的分享
博客园 - 司徒正美
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
T
Tor Project blog
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
Martin Fowler
Martin Fowler
酷 壳 – CoolShell
酷 壳 – CoolShell
Recorded Future
Recorded Future
D
DataBreaches.Net
Y
Y Combinator Blog
大猫的无限游戏
大猫的无限游戏
IT之家
IT之家
B
Blog RSS Feed
Scott Helme
Scott Helme
P
Proofpoint News Feed
V
Vulnerabilities – Threatpost
A
Arctic Wolf
Help Net Security
Help Net Security
L
LINUX DO - 最新话题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Vercel News
Vercel News
AWS News Blog
AWS News Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
S
Schneier on Security
Hacker News: Ask HN
Hacker News: Ask HN
N
Netflix TechBlog - Medium
L
LangChain Blog
博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
M
MIT News - Artificial intelligence
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
W
WeLiveSecurity

博客园 - hong

VBA命令按钮操作 - hong - 博客园 VBA访问word菜单 - hong - 博客园 RUP核心概念解析 RUP 核心概念 IBM Rational 技术文档下载 项目管理规范-RUP管理实施 感叹人生 遗憾 C#中的类型相等与恒等(Equality & Identity) Windows Vista workshop 理解抽象类和接口 线程概念 开始找工作了 BI理解 Web Service基础 改变人的一生的五句话 堆和栈的区别 sql日期转换问题 Visual Studio Team System资源
在web页面中显示多页的tif文件
hong · 2006-05-31 · via 博客园 - hong

一、显示指定index页序号的tiff图片

1、通过页面显示

在显示页面里:<img src="showtif.aspx" border=0>

采用类似于验证码的显示方法

showtif.aspx的页面代码写成下面:(该页不带后台代码)

<%@ Page language="c#" %>

<%@ Import Namespace="test"  %>

<% bind.showMulTif("img/aaa.tif",1);%>

方法showMulTif如下定义

        /// <summary>
        
/// 显示多页tif图片
        
/// </summary>
        
/// <param name="fielname">文件名</param>
        
/// <param name="index">显示页码</param>

        public static void showMulTif(string fielname,int index)
        
{
            HttpContext context 
= HttpContext.Current;
            
string bgFilePath = context.Server.MapPath(fielname);
            System.Drawing.Image imgObj 
= System.Drawing.Image.FromFile(bgFilePath);

            
//获得第index页的图片
            Guid objGuid   =(imgObj.FrameDimensionsList[0]);
            System.Drawing.Imaging.FrameDimension objDimension  
=new System.Drawing.Imaging.FrameDimension(objGuid);
            
//总页数
            int totFrame   ;
            totFrame
=imgObj.GetFrameCount(objDimension);

            
if (index>totFrame)
                index
=totFrame;
            
if (index<1)
                index
=1;
               
            imgObj.SelectActiveFrame(objDimension,index);


            
// 设置输出的MIME类型
            context.Response.ContentType = "image/gif";
            
// 输出文件流到浏览器中
            
//
            imgObj.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);
            
// 释放资源
            context.Response.Flush();
            context.Response.End();
        }


2、通过下载打开的方式,利用ioffice带的工具或图片查看器浏览

二、tif转换为jpg文件

将tif转换成多个jpge或者gif拉  

  public   int   SavePic(string   fullPath,int   index)   
  
{   
  
//使指定的页码在本图片的范围内   
  if(index   <   0   ||   index   >   this.frameNumber)   
  
{   
  index   
=   0;   
  }
   
    
  
//将指定的一页画到saveGif上,其中saveGif为指定的大小   
  Point   ulCorner   =   new   Point(0,   0);   
  Point   urCorner   
=   new   Point(this.saveWidth,0);   
  Point   llCorner   
=   new   Point(0,   this.saveHeight);   
  Point[]   destPara   
=   {ulCorner,   urCorner,   llCorner};   
    
  saveGif
=   new   Bitmap(this.saveWidth,this.saveHeight);   
  Graphics   save   
=   Graphics.FromImage(saveGif);   
  openTif.SelectActiveFrame(frameDime,index);   
  save.DrawImage(openTif,destPara);   
  save.Dispose();   
  save   
=   null;   
    
  
//将图片保存   
  saveGif.Save(fullPath,ImageFormat.Gif);   
  saveGif.Dispose();   
  saveGif   
=   null;   
    
  
return   1;   
  }