# 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

mode(baseline)
mode(enable_type_checks)
mode(enable_offset_checks)
mode(enable_ifd_checks)


#####
# 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))

# 259	0103	Compression	Compression scheme used on the image data 
### (1 means no compression)
259; mandatory; only(1)

# 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 (FORBIDDEN), 4 is Transparency Mask (FORBIDDEN)
262; mandatory; range(0, 2)

# 273	0111	StripOffsets	For each strip, the byte offset of that strip.
# TODO: 273; mandatory; range(1, 4294967295)
# Hint: Because value could be an array, only "any" is used, an array of n elements not supported yet
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); only(3)
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. 
# TODO: 279; mandatory; range(1, 4294967295)
# Hint: Because value could be an array, only "any" is used, an array of n elements not supported yet
279; mandatory; any

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

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

#####
# 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; logical_or(0, 2)

# 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; depends(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; only(1)

# 269   010D    Documentname
269; optional; printascii

# 270	010E	ImageDescription	A string that describes the subject of the image.
270; optional; fullascii

# 271	010F	Make	The scanner manufacturer.
271; optional; printascii

# 272	0110	Model	The scanner model name or number.
272; optional; printascii

# 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. 
# 274; optional; range(1, 8)	# THIS IS NOT BASELINE TIFF!!! DO NOT UNCOMMENT!!!
274; optional; only(1)

# 280	0118	MinSampleValue	The minimum component value used. Default is 0.
280; optional; any

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

# 284	011C	PlanarConfiguration		How the components of each pixel are stored. 1 = Chunky format. 2 = Planar format and Baseline TIFF readers are not required to support it. Default: 1.
284; optional; only(1)

# DO NOT UNCOMMENT! 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

# DO NOT UNCOMMENT! 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

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

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

# 305	0131	Software	Name and version number of the software package(s) used to create the image.
305; optional; printascii

# 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]$")
306; optional; datetime

# DO NOT UNCOMMENT! 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; any

# DO NOT UNCOMMENT! 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; any

# 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; optional; 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; optional; any

# DO NOT UNCOMMENT! 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

# DO NOT UNCOMMENT! 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)

# Sampleformat, default 1, list length = value of SamplesPerPixel (277)
339; optdepends(277.1); only(1)
339; optdepends(277.3); ntupel(1,1,1)

# 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; printascii

# DO NOT UNCOMMENT! 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

# DO NOT UNCOMMENT! 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. Mandatory for RGB 8-Bit/16-Bit, Optional for Grayscale
34675; optdepends(262.0); iccprofile
34675; optdepends(262.1); iccprofile
34675; depends(262.2); iccprofile
