Return-Path: <awaresystems.be+caf_=filtered=awaresystems.be@gmail.com>
Delivered-To: filtered@awaresystems.be
Received: from mx7.public.one.com ([10.246.18.27])
	by mail6.local.one.com (Dovecot) with LMTP id SS0RDVgIL1gRLwAAsyOMew
	for <filtered@awaresystems.be>; Fri, 18 Nov 2016 14:42:48 +0000
X-HalOne-ID: 4613d050-ad9d-11e6-92ff-549f350a6292
Received: from mail-oi0-f49.google.com (unknown [209.85.218.49])
	by mx7.public.one.com (Halon Mail Gateway) with ESMTPS
	for <filtered@awaresystems.be>; Fri, 18 Nov 2016 14:42:47 +0000 (UTC)
Received: by mail-oi0-f49.google.com with SMTP id 128so90440844oih.0
        for <filtered@awaresystems.be>; Fri, 18 Nov 2016 06:42:47 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-original-authentication-results:x-gm-message-state:delivered-to
         :message-id:date:from:user-agent:mime-version:to:subject:precedence
         :list-id:list-unsubscribe:list-archive:list-post:list-help
         :list-subscribe:content-transfer-encoding:sender:errors-to;
        bh=kcSVtVgbEyHaRsOrXxEkTLr3y2MNYOg/fWdBNOjs0Ik=;
        b=EoaJ12D5vKEeUkCCZDJYgDtMj3sThAvnHeUciXl63sf0q7uVlPzjjG1e4VNENJa13a
         s1J7YpJhWwYB0VVZhsgxN6op6DmRC/HdXX93eA8poyCxaUriwo1X009CY2om1KY4lUP/
         Q1C6PImf9Cx4SIiKzh+Yer+ezIRurXuWrptST5YJlN3GTsgS9L9K8OI1VDKuk549+QZD
         C5NU1/snJEr/oxdElkVdPvK7YrGduEiDTEopz9T0mJXuvsEFdikU76btYYyEUtRIVS6v
         cLKvYI/UQJpGuhLpJ2cehUsjBkMwnsLnagkQGwMlJjZ0wKJ6MTbU1NDvAwSIWL534kXz
         BU/Q==
X-Original-Authentication-Results: mx.google.com;       spf=neutral (google.com: 94.23.4.142 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) smtp.mailfrom=tiff-bounces@lists.maptools.org
X-Gm-Message-State: AKaTC036NUC6UYz6vd9hSdppqnORievF8r+kGfnaB/Ptd9bGmql9rQyoI2u1MjkgrjoliTK0UgEK5FxkOEmQVf7PB3iuysI=
X-Received: by 10.202.234.69 with SMTP id i66mr43424oih.38.1479480166065;
        Fri, 18 Nov 2016 06:42:46 -0800 (PST)
X-Forwarded-To: filtered@awaresystems.be
X-Forwarded-For: awaresystems.be@gmail.com filtered@awaresystems.be
Delivered-To: awaresystems.be@gmail.com
Received: by 10.202.192.135 with SMTP id q129csp151201oif;
        Fri, 18 Nov 2016 06:42:45 -0800 (PST)
X-Received: by 10.28.67.69 with SMTP id q66mr521983wma.22.1479480165061;
        Fri, 18 Nov 2016 06:42:45 -0800 (PST)
Return-Path: <tiff-bounces@lists.maptools.org>
Received: from lists.maptools.org (ks365428.kimsufi.com. [94.23.4.142])
        by mx.google.com with ESMTP id ld4si7835315wjb.62.2016.11.18.06.42.44;
        Fri, 18 Nov 2016 06:42:45 -0800 (PST)
Received-SPF: neutral (google.com: 94.23.4.142 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) client-ip=94.23.4.142;
Authentication-Results: mx.google.com;
       spf=neutral (google.com: 94.23.4.142 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) smtp.mailfrom=tiff-bounces@lists.maptools.org
Received: from [10.1.0.241] (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id CF2AA35C060;
	Fri, 18 Nov 2016 09:41:50 -0500 (EST)
Received: from polaris.osa.pri.ee (osa.pri.ee [213.219.84.188])
	by lists.maptools.org (Postfix) with ESMTP id B9A7B35C05E
	for <tiff@lists.maptools.org>; Fri, 18 Nov 2016 09:19:31 -0500 (EST)
Received: from localhost (localhost [127.0.0.1])
	by polaris.osa.pri.ee (Postfix) with ESMTP id 8B6C86E69A
	for <tiff@lists.maptools.org>; Fri, 18 Nov 2016 16:19:30 +0200 (EET)
X-Virus-Scanned: amavisd-new at osa.pri.ee
Received: from polaris.osa.pri.ee ([127.0.0.1])
	by localhost (osa.pri.ee [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id CxexolhLxZ1A for <tiff@lists.maptools.org>;
	Fri, 18 Nov 2016 16:18:32 +0200 (EET)
Received: from [0.0.0.0] (polaris.osa.pri.ee [213.219.84.188])
	by polaris.osa.pri.ee (Postfix) with ESMTP id 819136E657
	for <tiff@lists.maptools.org>; Fri, 18 Nov 2016 16:18:32 +0200 (EET)
Message-ID: <582F0DB7.1010906@osa.pri.ee>
Date: Fri, 18 Nov 2016 16:18:31 +0200
From: Paavo Helde <paavo@osa.pri.ee>
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64;
	rv:25.8) Gecko/20151117 FossaMail/25.1.9
MIME-Version: 1.0
To: tiff@lists.maptools.org
Subject: [Tiff] Generic use of TIFFSetField
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org


I'm now in a fresh attempt to use LibTIFF for TIFF file writing, mainly 
because I do not want to tweak with BigTIFF bit twiddling and create new 
obscure bugs. My task is to interface a scripting language layer, it 
sends in a table with TIFF tags and data and I need to produce a 
compliant TIFF file. Some tags like image width and bit depth I can set 
easily, based on the properties of the incoming image, but the script 
layer can send in also any other tags. In the previous "manual" 
implementation it was easy, if the script sent in e.g. a 3-element 
vector of int16 type for a tag, then I created a corresponding TIFF IFD 
entry and stored the info there. However, in LibTIFF I do not find such 
a function, there is TIFFSetField() which takes ellipsis arguments, but 
as far as I can see there is no way to tell it that I am sending a 
3-element array of int16, for example.

OK, I tried to do this in a harder way. I found the functions 
TIFFFieldWithTag(), TIFFFieldDataType() and TIFFFieldWriteCount() which 
ought to tell me the expected type and count of the data to be passed 
into the ellipsis. But it appears it's not so simple, for example for 
TIFFTAG_SMAXSAMPLEVALUE it reports me TIFF_ANY and TIFF_VARIABLE. On the 
other hand, the TIFFSetField() man page says that for 
TIFFTAG_SMAXSAMPLEVALUE I have to pass a single double. How do I 
translate TIFF_ANY and TIFF_VARIABLE into a single double? And what if I 
want to follow the TIFF standard and store N=SamplesPerPixel values 
instead of a single value?

Should I just copy the TIFFSetField man page and make a huge switch 
statement from it?

TIA,
Paavo

_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
