Return-Path: <SRS0=5chU=YD=lists.osgeo.org=tiff-bounces@osgeo.org>
Delivered-To: filtered@awaresystems.be
Received: from mx3.pub.mailpod8-cph3.one.com ([10.27.38.13])
	by mailstorage22.cst.mailpod8-cph3.one.com with LMTP
	id GHmeOZF95WKLYgAAwT5NuQ
	(envelope-from <SRS0=5chU=YD=lists.osgeo.org=tiff-bounces@osgeo.org>)
	for <filtered@awaresystems.be>; Sat, 30 Jul 2022 18:50:57 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=custmx.one.com; s=20201015;
	h=sender:content-type:list-subscribe:list-help:list-post:list-unsubscribe:
	 list-id:subject:to:message-id:date:from:mime-version:x-halone-refid:
	 x-halone-sa:from:x-halone-sa:x-halone-refid;
	bh=F99Sd2fJgOTCqWven1XhhB0aP80OMQ1Nnh7m2+Smzns=;
	b=tN0L7TFe50ed7GhaWusZXWVaGuRamLOva5lpoSY7mLDMIhZplvT72ciWQbykR3/GpyPwhfQLr/kBI
	 9xX6GJ8vGMY/hYRI2j9j3Yh6kc7xNkUb6VVNhgKqfpkLddNxDzyF4oyfEOzH8XxRdBH342utyuionX
	 EAOHULbXn+l8sGTf4V7CS/UPVUYBVg97xXfW2YZrDmgx5IHJ2qnPf5TjKllSWnkWceLb78RKo6yUoW
	 0+vI3/khEdTuQj1i8PIgQW9cL+AhKAJPvDJXusOda9Kh9VELvtBT2EtSKkDebA/JpSgInKIxvj4oSx
	 DELiEor4Fv0gnZEQFCX7+hDac3vZd9w==
X-HalOne-SA: -0.3
X-HalOne-RefID: str=0001.0A682F1B.62E57D91.0015:SCFSTAT44768166,ss=1,re=-4.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0
X-HalOne-ID: 8acdf815-1038-11ed-a21f-98039b062cb2
Received: from lists.osgeo.org (osgeo6.osgeo.osuosl.org [140.211.15.3])
	by mx3.pub.mailpod8-cph3.one.com (Halon) with ESMTPS
	id 8acdf815-1038-11ed-a21f-98039b062cb2;
	Sat, 30 Jul 2022 18:50:57 +0000 (UTC)
Received: from osgeo6.osgeo.osuosl.org (localhost [127.0.0.1])
	by lists.osgeo.org (Postfix) with ESMTP id 38F6161346C8;
	Sat, 30 Jul 2022 11:50:52 -0700 (PDT)
Authentication-Results: lists.osgeo.org;
	dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="NZSJO8ks";
	dkim-atps=neutral
Received: from mail-vs1-f52.google.com (mail-vs1-f52.google.com
 [209.85.217.52])
 by lists.osgeo.org (Postfix) with ESMTPS id EF3F96142C94
 for <tiff@lists.osgeo.org>; Sat, 30 Jul 2022 11:50:49 -0700 (PDT)
Received: by mail-vs1-f52.google.com with SMTP id c3so7584176vsc.6
 for <tiff@lists.osgeo.org>; Sat, 30 Jul 2022 11:50:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:from:date:message-id:subject:to;
 bh=qC0f8ULOi3RCPHgD5uJ51JmBzXeGcz8yd4F/0j5t65I=;
 b=NZSJO8ksJGRjBMJ9ZpYOjdco36biKZ4dDxCSfibtHBp2VPyYX7dXXEEU2H/WiZsn+I
 /uQqvUzVmVjkUxno63Fj7yuKSVWeL9/ttu0WkKMGFzPOSMkmpPsoih0jJklgl9HCiRJT
 Kpr3N7CTTukU7WdreWl2gJ5oxUBzBFbpuch+enkUMrcL43D7k67zzU6kBXD0KXnDxemL
 ElM+oA+/Vuog7rvAxC1n5QEoZekearMUEf6Ph/uKBe2wFLGBC9RNZ52CxWWPUfTq581J
 WQD4Uxbe9m5+1WLP/B5114uxNAsxUykX80oLH5kT0MHIo6WrNGw6eRnRzXN4KjV4DQHc
 03Bg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=qC0f8ULOi3RCPHgD5uJ51JmBzXeGcz8yd4F/0j5t65I=;
 b=t1gMqNGQpxxULvzGsZWU1G6qf03HEPjWaWvLN2WNkVloaVTPip9XwflSE6A1elViyt
 h+84nPvQbBhP/x9R1F7/sDHsBwiu/2Onk6hBwX/2H73NjUOSQZ8Uol8ZDivIk3Z3c/bP
 nBlXYaMm8GWHtmIGW6HFvOJ9DGhsug+4iCMNuEjP+0KvzKVumoRm5OI6IyiYbe6T8sDX
 NDzDxVH5Mw53KV9GvjGYAI+qdh7UAJAvdQkarLlOuF1y+uJcdX0rVI0lflDDOR64AYrA
 mOsEsy6WoXPFWsiVOp0HtAmhyFEuQAPqpPvJPV63qtv82bFkJZdiqLPj4PGtrklbbWhs
 yKxg==
X-Gm-Message-State: AJIora8MnancddmCKJ9TjiexUrKz8pSy/cIkE1egrU6zWpNNHQYVGMPX
 TIk5RQYeCwvaIr9y0rbjAAnc0omGcFZB/HJdct96GJaVgtY=
X-Google-Smtp-Source: AGRyM1siTO659v+GFRm1jbISpIyS09EMzX0nhbgx3MHiAP4Y/AdzpnJ74wYla1yPcn8rFjTaw1/iRXIXZcGWpR60SnE=
X-Received: by 2002:a67:1a45:0:b0:356:2063:d978 with SMTP id
 a66-20020a671a45000000b003562063d978mr3659070vsa.41.1659207048548; Sat, 30
 Jul 2022 11:50:48 -0700 (PDT)
MIME-Version: 1.0
From: Maged Rifaat <magedrifaat@gmail.com>
Date: Sat, 30 Jul 2022 20:50:37 +0200
Message-ID: <CAHPh12AmkuAefhBy2a43whuOdBGJzwq0OJA3OEOnOuG5OSAg+w@mail.gmail.com>
To: tiff@lists.osgeo.org
Subject: [Tiff] Strange behavior for the PlanarConfiguration tag in write
 mode
X-BeenThere: tiff@lists.osgeo.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.osgeo.org>
List-Unsubscribe: <https://lists.osgeo.org/mailman/options/tiff>,
 <mailto:tiff-request@lists.osgeo.org?subject=unsubscribe>
List-Post: <mailto:tiff@lists.osgeo.org>
List-Help: <mailto:tiff-request@lists.osgeo.org?subject=help>
List-Subscribe: <https://lists.osgeo.org/mailman/listinfo/tiff>,
 <mailto:tiff-request@lists.osgeo.org?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============8226284395980084907=="
Errors-To: tiff-bounces@lists.osgeo.org
Sender: "Tiff" <tiff-bounces@lists.osgeo.org>

--===============8226284395980084907==
Content-Type: multipart/alternative; boundary="000000000000bcd66205e50a3e14"

--000000000000bcd66205e50a3e14
Content-Type: text/plain; charset="UTF-8"

Hello everybody,

I noticed a strange behavior when trying to read the default value of the
PlanarConfiguration tag when trying to create a new Tiff file using
LibTIFF. When I try running the following code:
    TIFF *tif = TIFFOpen("test.tif", "w");
    unsigned short planar;
    TIFFGetFieldDefaulted(tif, TIFFTAG_PLANARCONFIG, &planar);
    printf("Default Planar value = %d\n", planar);

I get a value of 0 for the planar configuration although the standard
specified that the default value is 1 not 0.
Also if I try to write to this new Image:
    TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, 1);
    TIFFSetField(tif, TIFFTAG_IMAGELENGTH, 1);
    TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3);
    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
    unsigned char pixel[3] = {255, 255, 255};
    TIFFWriteEncodedStrip(tif, 0, pixel, 3);
    TIFFClose(tif);

I get an error message:
    TIFFWriteEncodedStrip: Must set "PlanarConfiguration" before writing
data.

Although the standard specifies that the PlanarConfiguration tag is not
required.

If the image is opened for reading, however, the default value is 1 even if
it doesn't exist in the image which is the expected behavior, so is this a
bug or this behavior necessary and if so, what is the reason behind this?

Best Regards
Maged

--000000000000bcd66205e50a3e14
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hello everybody,</div><div><br></div><div>I noticed a
 strange behavior when trying to read the default value of the=20
PlanarConfiguration tag when trying to create a new Tiff file using LibTIFF=
. When I try running the following code:<br>=C2=A0=C2=A0=C2=A0 TIFF *tif =
=3D TIFFOpen(&quot;test.tif&quot;, &quot;w&quot;);<br>=C2=A0=C2=A0=C2=A0 un=
signed short planar;<br>=C2=A0=C2=A0=C2=A0 TIFFGetFieldDefaulted(tif, TIFFT=
AG_PLANARCONFIG, &amp;planar);<br>=C2=A0=C2=A0=C2=A0 printf(&quot;Default P=
lanar value =3D %d\n&quot;, planar);<br></div><div><br></div><div>I get a v=
alue of 0 for the planar configuration although the standard specified that=
 the default value is 1 not 0.</div><div><div>Also=C2=A0if I try to write t=
o this new Image:<br>=C2=A0=C2=A0=C2=A0 TIFFSetField(tif, TIFFTAG_IMAGEWIDT=
H, 1);<br>=C2=A0=C2=A0=C2=A0 TIFFSetField(tif, TIFFTAG_IMAGELENGTH, 1);<br>=
=C2=A0=C2=A0=C2=A0 TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3);<br>=C2=A0=
=C2=A0=C2=A0 TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);<br>=C2=A0=C2=A0=
=C2=A0 unsigned char pixel[3] =3D {255, 255, 255};<br>=C2=A0=C2=A0=C2=A0 TI=
FFWriteEncodedStrip(tif, 0, pixel, 3);<br>=C2=A0=C2=A0=C2=A0 TIFFClose(tif)=
;<br></div><div><br></div><div>I get an error message:</div><div>=C2=A0=C2=
=A0=C2=A0 TIFFWriteEncodedStrip: Must set &quot;PlanarConfiguration&quot; b=
efore writing data.</div><div><br></div><div>Although the standard specifie=
s that the PlanarConfiguration tag is not required.</div><div><br></div><di=
v>If
 the image is opened for reading, however, the default value is 1 even=20
if it doesn&#39;t exist in the image which is the expected behavior, so is=
=20
this a bug or this behavior necessary and if so, what is the reason=20
behind this?</div><div><br></div><div>Best Regards</div><font color=3D"#888=
888"><div>Maged</div></font></div></div>

--000000000000bcd66205e50a3e14--

--===============8226284395980084907==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Tiff mailing list
Tiff@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/tiff

--===============8226284395980084907==--
