• Save images into a multi-page TIFF file or add images to an existing TIFF file bijulsoni, 27 Dec 2006 CPOL  4.85 (24 votes)

    Save images into a multi-page TIFF file or add images to an existing TIFF file

    bijulsoni27 Dec 2006 CPOL
    Rate:
    Describes how to save images into a multi-page TIFF file and append images to an existing TIFF file by applying CCITT4 compression.
    Is your email address OK? You are signed up for our newsletters but your email address is either unconfirmed, or has not been reconfirmed in a long time. Please click here to have a confirmation email sent so we can confirm your email address and start sending you newsletters again. Alternatively, you can update your subscriptions.

    Load Image

    Introduction

    This article describes a way for saving images into the multi-page TIFF format by applying CCITT4 compression. It also explains how to append images to existing single page or multi-page TIFF files. Before that, we will understand what is tiff and why we should use the TIFF format.

    What is TIFF ?

    Tagged Image FIle Format (TIFF) is a highly used file format for storing images in many image processing applications. Using TIFF, we can store several images either as a single page or as a multi-page TIFF file. We can also append new images to existing single page or multi-page TIFF files. Many compressions like CCITT3, CCITT4, are also applied to TIFF files. Image related data like scanner name, compression type, bits per pixel, and host computer name are also stored in TIFF files using tags. Due to all these benefits, TIFF files are highly used in many applications.

    You can download the sample code. The sample code attached with this article shows the following two things:

    1. How to store multiple images into single multi-page TIFF file with CCITT4 compression.
    2. How to append multiple images to existing single page or multi-page TIFF files with CCITT4 compression.

    The reason for storing images with the CCITT4 compression is because programmers, initially, while playing with TIFF, generally face many problems when trying to store images with the CCITT4 compression using .NET. The most common error message is "Invalid Parameter". The most probable reason for this error is that the image on which you are trying to apply CCITT4 compression is not a bi-tonal image. The CCITT4 compression is applicable to bi-tonal images only. So I have given code for converting an image to a bi-tonal image. The code given in the sample application uses .NET GDI+ classes for storing images.

    How to store images into a single multi-page TIFF file with CCITT4 compression

    Consider the following screen:

    Load Image

    You can load as many images as you want by clicking the Load Images button. All these images will be shown in panels. Now, you can click the SaveAsMultipage button. A save file dialog will open, and you can specify file name and click on the Save button. If all images are successfully saved, then a message box will appear with the message "all images saved successfully". Smile | :)  

    How to append multiple images to existing single page or multi-page TIFF files

    You can load as many images as you want by clicking the Load Images button. All these images will be shown in panels. Now you can click the AddtoExistingFile button. An open file dialog will open and you can specify a file name by selecting any TIFF file from the file system and clicking on the Save button. If all images are successfully saved, then a message box will appear with the message "all images saved successfully".

    Explanation of Code

    All the above operations are done by following three functions

    • public bool saveMultipage(Image[] bmp, string location, string type)

      This function is responsible for receiving an array of images and for saving these images on the target location in multi-page TIFF file format.

    • public bool saveToExistingFile(string fileName, Image[] bmp, string type)

      This function is responsible for appending an array of images on an existing TIFF file which is specified by the file name parameter.

    • public Bitmap ConvertToBitonal(Bitmap original)

      This function takes a Bitmap object which is a non-bitonal image and converts that image into a bitonal image. This is required to apply CCITT4 compression. We can not apply CCITT4 compression on non-bitonal Images.

    License

    This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




    原文:http://www.codeproject.com/Articles/16904/Save-images-into-a-multi-page-TIFF-file-or-add-ima

    展开全文
  • C#tiff文件操作类 2020-07-06 23:31:22
    winForm程序选择tiff文件后,对tiff文件进行拆分,将拆分后的矩阵展示在窗口中,可以拆分多个tiff文件展示在窗口,点击合并后,将所有展示的图片合并成新的tiff文件并输出到本地
  • tiffbmp的实现 2020-04-12 21:46:18
    tiff文件格式内容见之前的文章 本次实验,自己用ps做了一个160*90的压缩图像,预览图如下 由于rgb本身就是倒着存的,希望得到一个倒过来的图像 黑底白字便于对着二进制文件找错,实现如下: header.h 该文件里...
  • C#处理TIFF格式 2010-06-30 13:34:00
    using System; using System.IO; using System.Drawing; using System.Drawing.Imaging; using System.Collections; <br />namespace RSExplorer { /// <summary> ...
  • 在自己写代码之前,参考了站...1、tiff文件读取 http://blog.csdn.net/zhouxuguang236/article/details/7846615 2、TIFF图像文件详解 http://blog.csdn.net/han_jiang_xue/article/details/8266207 3、libtiff使用小记
  • PDF是一种在我们日常工作学习中最常用到的文档格式之一,但常常也会因为文档的不易编辑的特点,在遇到需要编辑PDF文档内容或者转换文件格式的情况时让人苦恼。通常对于开发者而言,可选择通过使用组件的方式来实现...
  • C#使用GDAL读取DEM数据 2014-11-15 14:20:13
    读取DEM数据步骤及说明 1. 将gdal180.dll、gdal_wrap.dll、 gdal_csharp.dll拷贝到程序的生成目录,并在项目里添加对gdal_csharp.dll库的引用。 2. 在要使用gdal的文件头部加上如下命名空间的声明: ...
  • C#中将.bmp转为.jpg格式的函数或类是什么,以及jpg文件的压缩函数---------------------------------------------------------------自己写个, public class Bmp2Jpeg { private long lQuality=50L;...
  • C#操作TIF文件 2019-07-21 03:29:19
    发送电​​子邮件由System.Web.Mail.MailMessage中 C#handiz @ hotmail.com ------------------------------------------- ----------public void SendMail(string recp, string title, string msg){//d...
  • private void jpgToolStripMenuItem_Click(object sender, EventArgs e) { Gdal.AllRegister(); Gdal.SetConfigOption("GDAL_FILENAME_IS_UTF8", "YES"); string file
  • C#+GDAL读取影像(1) 2019-01-02 06:12:11
    环境:VS2010,C#,GDAL1.7 读取影像: 1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System....
  • C# Tif格式转Jpg 2017-09-26 17:24:35
    C# Tif格式转jpg
  • tiff或tif文件的读取 2019-01-10 11:18:00
    以下是VC下读取TIFF文件的代码 char* szFileName = "K:\\地图\\fujian-DEM\\fujian1.tif"; TIFF* tiff = TIFFOpen(szFileName, "r");//打开Tiff文件,得到指针,以后所有的操作都通过指针...
  • 在AE+C#读取地图数据的代码十分简单,因此此篇分享还加上了将地图文件输出的代码。 还是老规矩,先把相关的引用放上来using ESRI.ArcGIS.Carto;using ESRI.ArcGIS.Geodatabase;using ESRI.ArcGIS....
  • Tiff转换Bitmap处理方法 2012-12-05 13:16:51
    首先项目中引入BitMiracle.LibTiff.NET的dll 命名空间: using BitMiracle.LibTiff.Classic; using System.Runtime.InteropServices; using System.Windows.Forms;...private static Bitmap TiffToBitmap(string ...
  • C# 操作TIF 2019-07-03 07:15:26
    ASP.net 1.1 smtp发邮件 Sent email by System.Web.Mail.MailMessage in c# -handiz@hotmail.com ---------------...
  • 基于C#和DGAL包实现栅格影像的读取和显示GDAL包提供了诸多处理栅格影像的方法,本文就将详细介绍基于GDAL包和C#语言如何实现栅格影像的读取和显示,这种实现是在VS2015的开发环境中完成。要像实现栅格影像数据的读取...
  • 使用GdPicture.NET图形处理控件不仅能将图像扫描成TIFF格式,并能将多页的TIFF文件转换为BMP格式文件,无疑给了图像处理更多的选择。 原文:http://www.evget.com/zh-CN/Info/catalog/18305.html
  • 其实我一直都是喜欢自己去做图像格式的解码的(目前我自己解码的图像格式大概有15种),但是写本文主要原因是基于CSDN的这个帖子的: http://bbs.csdn.net/topics/390510431 用... 用于测试的原始的JPG图像:h...
  • 首先创建一个Windows窗体应用程序,然后拖几个按钮和文本框,如下图所示。第一行用来显示栅格数据的路径,点击浏览找到一个栅格文件,将路径显示在文本框中,然后点击读取,将图像的基本信息显示在最下方的富文本框...
1 2 3 4 5 ... 20
收藏数 1,217
精华内容 486