Return-Path: <tiff-bounces@remotesensing.org>
Received: from inav016.isp.belgacom.be (inav016.isp.belgacom.be [195.238.2.248])
        by mailst035.isp.belgacom.be (8.12.11/8.12.11/Skynet-MAILSTORE-2.14) with ESMTP id iAG66wTk011060
        for <joris.at.lebbeke@skynet.be>; Tue, 16 Nov 2004 07:06:58 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from inas007.isp.belgacom.be (localhost [127.0.0.1])
        by inav016.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AV-3.00) with ESMTP id iAG66n78017725
        for <joris.at.lebbeke@skynet.be>; Tue, 16 Nov 2004 07:06:49 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from inmx012.isp.belgacom.be (inmx012.isp.belgacom.be [195.238.3.90])
        by inas007.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AS-2.03) with ESMTP id iAG66gx1021198
        for <joris.at.lebbeke@skynet.be>; Tue, 16 Nov 2004 07:06:43 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from xserve.flids.com (adsl-065-083-169-202.sip.mco.bellsouth.net [65.83.169.202])
        by inmx012.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id iAG66VuW031308
        for <joris.at.lebbeke@skynet.be>; Tue, 16 Nov 2004 07:06:37 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from adsl-065-083-169-202.sip.mco.bellsouth.net (localhost [127.0.0.1])
	by xserve.flids.com (Postfix) with ESMTP
	id 69B3F47BF31; Tue, 16 Nov 2004 01:05:46 -0500 (EST)
X-Original-To: tiff@remotesensing.org
Delivered-To: tiff@remotesensing.org
Received: from cgp.pu.ru (vlan3.cgp.pu.ru [195.70.196.209])
	by xserve.flids.com (Postfix) with ESMTP id 6F58F47BEEB
	for <tiff@remotesensing.org>; Tue, 16 Nov 2004 01:05:43 -0500 (EST)
Received: from wg.pu.ru ([193.124.85.219] verified)
	by cgp.pu.ru (CommuniGate Pro SMTP 4.2.5)
	with ESMTP id 34854611 for tiff@remotesensing.org;
	Tue, 16 Nov 2004 09:02:21 +0300
Received: (from uucp@localhost)
	by wg.pu.ru (8.9.1a/8.9.1) with UUCP id GAA09226
	for tiff@remotesensing.org; Tue, 16 Nov 2004 06:05:41 GMT
Received: from ak4719.spb.edu (localhost [127.0.0.1])
	by ak4719.spb.edu (8.12.11/8.12.11/Debian-5) with ESMTP id
	iAG5sWFn008684
	for <tiff@remotesensing.org>; Tue, 16 Nov 2004 08:54:32 +0300
Received: (from dron@localhost)
	by ak4719.spb.edu (8.12.11/8.12.11/Debian-5) id iAG5sWmw008681
	for tiff@remotesensing.org; Tue, 16 Nov 2004 08:54:32 +0300
From: Andrey Kiselev <dron@ak4719.spb.edu>
Date: Tue, 16 Nov 2004 08:54:32 +0300
To: tiff@remotesensing.org
Subject: Re: [Tiff] regarding tiff to bitmap
Message-ID: <20041116055432.GB7489@ak4719.spb.edu>
Mail-Followup-To: tiff@remotesensing.org
References: <9753A88725D7D3119BE0009027CC6CA20427C7A0@mailsrvnt01.sharp.co.i n>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <9753A88725D7D3119BE0009027CC6CA20427C7A0@mailsrvnt01.sharp.co.i
	n>
X-GnuPG-Key: http://www.srces.spb.org/dron/export.home.key
X-Face: "t+se9s~+y~[XUH]L|pmeO3Pt/Q@DNv**S, d@_1-C=}/,
	c%<3Qp]eu!ok<"2lYJm$!9qVcg F?7o*L; |$`6|Q|>Rt-cU%2_y@6tQ|`!Li}TsvZvEKx;
	>fuY=fc(=sX^`7Wmw8%SsR`AvM$a; 0U/eN\ P?B\FTyqD, 0np$U2!*'z_4D,
	VPlFf?bN0&zYf"zF0s!7Tl7?$we)xD0@lL>[h|8bhys0i.g|zLnu@C
	Ti@d]i=[!:j1CB\5/TF[m]`lfHfaqSN[0qn@T3zeosV/[LAss{@p_?],x*j8P_9t[}uHD^X-;
	j~\M! gyTly;fj`}&Y~i{<#bN.#QmkE}#T`dxP.I1\.)_MEN{@#W
User-Agent: Mutt/1.5.6+20040722i
X-Virus-Scanned: clamd / ClamAV version 0.75-1, clamav-milter version 0.75c
	on ak4719
X-Virus-Status: Clean
X-BeenThere: tiff@remotesensing.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: TIFF and libtiff discussion  <tiff.remotesensing.org>
List-Unsubscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=unsubscribe>
List-Archive: <http://xserve.flids.com/pipermail/tiff>
List-Post: <mailto:tiff@remotesensing.org>
List-Help: <mailto:tiff-request@remotesensing.org?subject=help>
List-Subscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=subscribe>
Sender: tiff-bounces@remotesensing.org
Errors-To: tiff-bounces@remotesensing.org
X-UIDL: 679ed188ecaa2bcfd183f14a20dbfb7a

On Tue, Nov 16, 2004 at 10:40:29AM +0530, Meenatchi Raja Rajeshwari wrote:
> i want to convert a tiff file in to a bitmap file.
> can anybody help me regarding  that.
> i have some problem with the following  code
> 
> 	TIFF *inpimage=NULL;
> 	inpimage=TIFFOpen("D:\\output_files\\appurgb280multi13x18.tiff",
> "w");
> 	uint32 imwidth=800;
> 	int imheight=800;
> 	
> //	int h=TIFFGetField(inpimage, TIFFTAG_IMAGEWIDTH, &imwidth);
> //	TIFFGetField(inpimage, TIFFTAG_IMAGELENGTH, &imheight);
> 	tsize_t imlinesize_bytes=TIFFScanlineSize(inpimage);
> 	uint8 *read_buff=(uint8 *)malloc(imlinesize_bytes*imheight);
> 	BYTE *bits=read_buff;

Quick follow-up.
Your code is wrong here.

> 	for(int row=1;row<=imheight;row++)
> 	{
> 		if (TIFFReadScanline(inpimage,bits, row, 0)==-1)

row number in TIFFReadScanline() call should start from 0, not 1.

> 			AfxMessageBox("Complete or error",MB_OK,NULL);
> 		bits=read_buff+row*imwidth;

Use imlinesize_bytes to increment the pointer, otherwise you should
remember about SamplesPerPixel and BitsPerSample parameters and take in
account them too.

					Andrey

-- 
Andrey V. Kiselev
Home phone:  +7 812 5970603  ICQ# 26871517
_______________________________________________
Tiff mailing list
Tiff@remotesensing.org
http://xserve.flids.com/mailman/listinfo/tiff
