# tag; required; values
#
# works as whitelist
# * tag: any tag number in TIFF
# * required: mandatory | optional | depends( $tag.$value ) | optdepends( $tag.$value ) 
# * values: range($start, $end) | logical_or( $a, …) | only($a) |any

# This defines a sample config for baseline tiffs
# Remember, because it works as whitelist for each required tag we need an
# entry here

#####
# Required Baseline Tags
#####

# 256	0100	ImageWidth	The number of columns in the image, i.e., the number of pixels per row.
256; mandatory; range(1, 4294967295)
# 257	0101	ImageLength	The number of rows of pixels in the image.
257; mandatory; range(1, 4294967295)

# 258	0102	BitsPerSample	Number of bits per component.
##########################258; mandatory; logical_or(8,16)
# Bitonal is optional, grey & RGB is mandatory. If 262 AND 258 exist, then the values need to be in the specified range.
258; optdepends(262.0); logical_or(1, 4, 8)
258; optdepends(262.1); logical_or(1, 4, 8)
#258; depends(262.2); logical_or(ntupel(8,8,8), ntupel(16,16,16))
# TODO: this field allows a different number of bits per component for each component corresponding to a pixel. For example, RGB color data could use a different number of bits per component for each of the three color planes.
258; depends(262.2); logical_or(ntupel(8,8,8), ntupel(16,16,16))
258; depends(262.3); logical_or(4, 8)
258; depends(262.8); only(8)

# 259	0103	Compression	Compression scheme used on the image data 
### (1 means no compression)
259; mandatory; logical_or(1, 2, 3, 4, 5, 6, 32773)

# 262	0106	PhotometricInterpretation	The color space of the image data.
### 2 means RGB, 0 and 1 means bilevel or grayscale, 0 is unusual, 3 is Palette Color (NOT SUITABLE FOR LONG TERM PRESERVATION), 4 is Transparency Mask (NOT SUITABLE FOR LONG TERM PRESERVATION)
262; mandatory; logical_or(range(0, 6), only(8))

# 273	0111	StripOffsets	For each strip, the byte offset of that strip.
273; mandatory; any

# 277	0115	SamplesPerPixel	The number of components per pixel.
### if RGB then 3 else 1
### Even though Baseline TIFF allows for SamplesPerPixel>3, we do NOT allow this for long term archival.
277; depends(262.2); range(3, 10)
277; optdepends(262.1); only(1)
277; optdepends(262.0); only(1)

# 278	0116	RowsPerStrip	The number of rows per strip.
278; mandatory; range(1, 4294967295)

# 279	0117	StripByteCounts	For each strip, the number of bytes in the strip after compression.
279; mandatory; range(1, 4294967295)

# 282	011A	XResolution	The number of pixels per ResolutionUnit in the ImageWidth direction.
282; mandatory; range(0, 4294967295)

# 283	011B	YResolution	The number of pixels per ResolutionUnit in the ImageLength direction.
283; mandatory; range(0, 4294967295)

# 296	0128	ResolutionUnit	The unit of measurement for XResolution and YResolution. 1 = No absolute unit of measurement. 2 = Inch. 3 = Centimeter. Default: 2
296; mandatory; range(1, 3)

#####
# optional fields
#####

# NO OTHER VALUES FROM THE RANGE (0 - 7) ARE ALLOWED. ONLY "0" IS SUITABLE FOR LONG TERM ARCHIVAL.
# 254	00FE	NewSubfileType	A general indication of the kind of data contained in this subfile. These values are defined as bit flags because they are independent of each other. Default is 0.
254; optional; range(0, 7)

# DO NOT UNCOMMENT! THIS TAG IS DEPRECATED! USE NEW SUBFILE TYPE INSTEAD!
# 255	00FF	SubfileType		A general indication of the kind of data contained in this subfile. This field is deprecated. The NewSubfileType field should be used instead.
255; optional; range(1, 3)

# DO NOT UNCOMMENT! THRESHOLDING IS NOT SUITABLE FOR LONG TERM ARCHIVAL!
# 263	0107	Threshholding	For black and white TIFF files that represent shades of gray, the technique used to convert from gray to black and white pixels. Default is 1.
263; optional; range(1, 3)

# DO NOT UNCOMMENT! CELL WIDTH IS NOT SUITABLE FOR LONG TERM ARCHIVAL!
# 264	0108	CellWidth	The width of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file.
264; depends(263.2); any

# DO NOT UNCOMMENT! CELL LENGTH IS NOT SUITABLE FOR LONG TERM ARCHIVAL!
# 265	0109	CellLength	The length of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file. This field should only be present if Threshholding = 2.
265; optdepends(263.2); any

### Support for FillOrder=2 is not required in a Baseline TIFF compliant reader. Default is 1.
# 266	010A	FillOrder	The logical order of bits within a byte.
266; optional; logical_or(1, 2)

# 269   010D    Documentname
269; optional; regex("^[[:print:]]*$")

# 270	010E	ImageDescription	A string that describes the subject of the image.
270; optional; regex("^[[:print:]]*$")

# 271	010F	Make	The scanner manufacturer.
271; optional; regex("^[[:print:]]*$")

# 272	0110	Model	The scanner model name or number.
272; optional; regex("^[[:print:]]*$")

# 274	0112	Orientation		The orientation of the image with respect to the rows and columns. Default is 1, and only this value is Baseline TIFF conform. 
# THIS IS NOT BASELINE TIFF!!!
274; optional; range(1, 8)
# 274; optional; only(1)

# 280	0118	MinSampleValue	The minimum component value used. Default is 0.
280; optional; range(0, 65534)

# 281	0119	MaxSampleValue	The maximum component value used; only for statistical purposes. Default is 2**(BitsPerSample) - 1.
281; optional; range(1, 65535)

# 284	011C	PlanarConfiguration		How the components of each pixel are stored. 1 = Chunky format. 2 = Planar format (not recommended for general interchange) and Baseline TIFF readers are not required to support it. Default: 1.
# If SamplesPerPixel is 1, PlanarConfiguration is irrelevant, and need not be included.
284; optional; logical_or(1, 2)

# 285	011D	PageName	The name of the page from which this image was scanned.
285; optional; regex("^[[:print:]]*$")

# 286	011E	XPosition	The X offset in ResolutionUnits of the left side of the image, with respect to the left side of the page.
285; optional; any

# 287	011F	YPosition	The Y offset in ResolutionUnits of the top of the image, with respect to the top of the page. In the TIFF coordinate scheme, the positive Y direction is down, so that YPosition is always positive.
285; optional; any

# FREE OFFSETS ARE NOT SUITABLE FOR LONG TERM ARCHIVAL!
# 288	0120	FreeOffsets	For each string of contiguous unused bytes in a TIFF file, the byte offset of the string. Not recommended for general interchange.
288; optional; any

# FREE BYTE COUNTS ARE NOT SUITABLE FOR LONG TERM ARCHIVAL!
# 289	0121	FreeByteCounts	For each string of contiguous unused bytes in a TIFF file, the number of bytes in the string. Not recommended for general interchange.
289; optional; any

# 290	0122	GrayResponseUnit	The precision of the information contained in the GrayResponseCurve. Default: 2; Recommended: 3
290; optdepends(262.0); range(1, 5)
290; optdepends(262.1); range(1, 5)

# 291	0123	GrayResponseCurve	For grayscale data, the optical density of each possible pixel value.
291; optdepends(262.0); any
291; optdepends(262.1); any

# 292	0124	T4Options	Option flags for T4 compression. Default: 0
291; optdepends(259.3); range(0, 4294967296)

# 293	0125	T6Options	Option flags for T4 compression. Default: 0
291; optdepends(259.4); range(0, 4294967296)

# 297           PageNumber      actual page, and total pagecount, the actual page count starts with 0; Recommended: 0, 1
# 297; optional; ntupel(0,1)
297; optional; any

# 301	012D	TransferFunction	Describes a transfer function for the image in tabular style.
301; optdepends(262.2); any

# 305	0131	Software	Name and version number of the software package(s) used to create the image.
305; optional; regex("^[[:print:]]*$")

# 306	0132	DateTime	Date and time of image creation in the format "YYYY:MM:DD HH:MM:SS".
306; optional; regex("^[12][901][0-9][0-9]:[01][0-9]:[0-3][0-9] [012][0-9]:[0-5][0-9]:[0-6][0-9]$")

# ARTIST IS NOT SUITABLE FOR LONG TERM ARCHIVAL DUE TO PRIVACY CONCERNS!
# 315	013B	Artist		Person who created the image. Some older TIFF files used this tag for storing Copyright information.
315; optional; regex("^[[:print:]]*$")

# HOST COMPUTER INFORMATION IS NOT SUITABLE AND IRRELEVANT FOR LONG TERM ARCHIVAL!
# 316	013C	HostComputer	The computer and/or operating system in use at the time of image creation.
316; optional; regex("^[[:print:]]*$")

# 317	013D	Predictor	A predictor is a mathematical operator that is applied to the image data before an encoding scheme is applied. Currently this field is used only with LZW. Default: 1
316; optdepends(259.5); logical_or(1, 2)

# WhitePoint, if RGB, points to chromaticity of the white point of the image.This is the chromaticity
# when each of the primaries has its ReferenceWhite value. The value is described using the 1931 CIE
# xy chromaticity diagram and only the chromaticity is specified. This value can correspond to the 
# chromaticity of the alignment white of a monitor, the filter set and light source combination of a
# scanner or the imaging model of a rendering package. The ordering is white[x], white[y].  
# (Source: www.awaresystems.be)
# example: CIE Standard Illuminant D65 used by CCIR Recommendation 709 and Kodak PhotoYCC is:
# 3127/10000,3290/10000 
318; optdepends(262.2); any

# PrimaryChromaticities, This is the chromaticity for each of the primaries when it has its ReferenceWhite
# value and the other primaries have their ReferenceBlack values. These values are described using the 
# 1931 CIE xy chromaticity diagram and only the chromaticities are specified. These values can correspond
# to the chromaticities of the phosphors of a monitor, the filter set and light source combination of a 
# scanner or the imaging model of a rendering package. 
# (Source: www.awaresystems.be)
# The ordering is red[x], red[y], green[x], green[y], blue[x], and blue[y].
# For example the CCIR Recommendation 709 primaries are:
# 640/1000,330/1000,
# 300/1000, 600/1000,
# 150/1000, 60/1000  
319; optdepends(262.2); any

# COLOR MAP TIFFS ARE NOT SUITABLE FOR LONG TERM ARCHIVAL!
# 320	0140	ColorMap	This field defines a Red-Green-Blue color map (often called a lookup table) for palette color images.
320; optional; any

# 321	0141	HalftoneHints	The purpose of the HalftoneHints field is to convey to the halftone function the range of gray levels within a colorimetrically-specified image that should retain tonal detail.
321; optional; any

# 322	0142	TileWidth	The tile width in pixels. This is the number of columns in each tile. Must be a multiple of 16.
322; optional; range(16, 4294967296)

# 323	0143	TileLength	The tile length (height) in pixels. This is the number of rows in each tile. Must be a multiple of 16.
323; optional; range(16, 4294967296)

# 324	0144	TileOffsets	For each tile, the byte offset of that tile, as compressed and stored on disk.
324; optional; range(1, 4294967296)

# 325	0145	TileByteCounts	For each tile, the number of (compressed) bytes in that tile.
325; optional; range(1, 4294967296)

# 332	014C	InkSet	The set of inks used in a separated (PhotometricInterpretation=5) image. Default: 1
332; optdepends(262.5); logical_or(1, 2)

# 333	014D	InkNames	The name of each ink used in a separated (PhotometricInterpretation=5) image, written as a list of concatenated, NUL-terminated ASCII strings.
333; optdepends(262.5); regex("^[[:print:]]*$")

# 334	014E	NumberOfInks	The number of inks. Usually equal to SamplesPerPixel, unless there are extra samples. Default: 4
334; optional; range(1, 10)

# 336	0150	DotRange	The component values that correspond to a 0% dot and 100% dot. DotRange[0] corresponds to a 0% dot, and DotRange[1] corresponds to a 100% dot.
336; optional; any

# 337	0151	TargetPrinter	A description of the printing environment for which this separation is intended.
337; optional; regex("^[[:print:]]*$")

# EXTRA SAMPLES TIFFS ARE NOT SUITABLE FOR LONG TERM ARCHIVAL BECAUSE THEIR MEANING CANNOT BE DOCUMENTED!
# 338	0152	ExtraSamples	Description of extra components.
338; optional; range(0, 2)

# 339	0153	SampleFormat	This field specifies how to interpret each data sample in a pixel. Default: 1
339; optional; range(1, 4)

# 340	0154	SMinSampleValue	This field specifies the minimum sample value.
340; optional; any

# 341	0155	SMaxSampleValue	This field specifies the maximum sample value.
341; optional; any

# 342	0156	TransferRange Expands the range of the TransferFunction.
342; optdepends(262.2); any

# 512	0200	JPEGProc	This Field indicates the JPEG process used to produce the compressed data.
512; depends(259.6); logical_or(1, 14)

# 513	0201	JPEGInterchangeFormat	This Field indicates whether a JPEG interchange format bitstream is present in the TIFF file.
513; optdepends(259.6); any

# 514	0202	JPEGInterchangeFormatLength	This Field indicates the length in bytes of the JPEG interchange format bitstream.
514; optdepends(259.6); any

# 515	0203	JPEGRestartInterval	This Field indicates the length of the restart interval used in the compressed image data.
515; optdepends(259.6); any

# 517	0205	JPEGLosslessPredictors	This Field points to a list of lossless predictor-selection values, one per component.
517; optdepends(259.6); range(1, 7)

# 517	0205	JPEGPointTransforms	This Field points to a list of point transform values, one per component.
517; optdepends(259.6); any

# 519	0207	JPEGQTables	This Field points to a list of offsets to the quantization tables, one per component.
519; optdepends(259.6); any

# 520	0208	JPEGDCTables	This Field points to a list of offsets to the DC Huffman tables or the lossless Huffman tables, one per component.
520; optdepends(259.6); any

# 521	0209	JPEGACTables	This Field points to a list of offsets to the Huffman AC tables, one per component.
521; optdepends(259.6); any

# 529	0211	YCbCrCoefficients	The transformation from RGB to YCbCr image data.
529; optdepends(262.6); any

# 530	0212	YCbCrSubSampling	Specifies the subsampling factors used for the chrominance components of a YCbCr image. The default values of this field are [ 2, 2 ].
#530; optdepends(262.6); logical_or(ntupel(1,1),ntupel(1,2),ntupel(1,4),ntupel(2,1),ntupel(2,2),ntupel(2,4),ntupel(4,1),ntupel(4,2),ntupel(4,4))
530; optdepends(262.6); any

# 531	0213	YCbCrPositioning	Specifies the positioning of subsampled chrominance components relative to luminance samples.
531; optdepends(262.6); any

# 532	0214	ReferenceBlackWhite	Specifies a pair of headroom and footroom image data values (codes) for each pixel component.
532; optdepends(262.2); any

# 700	02BC	XMP		XML packet containing XMP metadata.
700; optional; any

# 33432	8298	Copyright	Complete copyright notice of the person or organization that claims the copyright to the image.
33432; optional; regex("^[[:print:]]*$")

# IPTC METADATA ARE NOT SUITABLE FOR LONG TERM ARCHIVAL!
# 33723 83BB	IPTC	IPTC (International Press Telecommunications Council) metadata. 
# http://www.iptc.org/download/download.php?fn=IIMV4.1.pdf
33723; optional; any

# PHOTOSHOP METADATA ARE PROPRIETARY AND HENCE NOT SUITABLE FOR LONG TERM ARCHIVAL!
# 34377	8649	Photoshop	Collection of Photoshop 'Image Resource Blocks'.
34377; optional; any

# 34665	8769	Exif IFD	 A pointer to the Exif IFD. Exif IFD is a set of tags for recording Exif-specific attribute information. It is pointed to by the offset from the TIFF header (Value Offset) indicated by an Exif private tag value. An Exif IFD has the same structure as that of the IFD specified in TIFF. Ordinarily, however, it does not contain image data as in the case of TIFF. 
34665; optional; any

# 34675	8773	ICC Profile		ICC Profile data
34675; optional; any

