Bonsoir,

On avait un peu abordé le problème dans un autre fil, je préfère le reprendre ici, ça sera plus propre.

En résumé, j'ai droit au message d'erreur
Error while reading stream: expected PhotometricInterpretation, but found 8 at position 80
quand j'essaie d'ouvrir un fichier CIE L*a*b*

J'ai trouvé sur un site une méchante diatribe envers FreePascal (c'est moi qui mets en gras) :
[...] a missing photometric interpretation tag is a very serious violation of the Tiff specification. There is a fair chance that the software that has left this tag out has violated the spec somewhere else as well, or that the file has been corrupted.
Le fichier en question se trouve là (un zip à télécharger, lien dans le second paragraphe sous l'image) et il est parfaitement valide puisqu'il est correctement affiché dans l'explorateur de fichiers pcManFM de Linux, par un visionneur d'images, par the Gimp mais aussi par XnView dans une machine virtuelle XP sp2.
Et, toujours sous Linux, tiffinfo me remonte des informations correctes :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
# tiffinfo ColorCheckerCalculator.tif 
TIFF Directory at offset 0x8 (8)
  Subfile Type: (0 = 0x0)
  Image Width: 798 Image Length: 546
  Resolution: 61.385, 61.385 pixels/inch
  Bits/Sample: 8
  Compression Scheme: LZW
  Photometric Interpretation: CIE L*a*b*
  Samples/Pixel: 3
  Rows/Strip: 3
  Planar Configuration: single image plane
  Photoshop Data: <present>, 4578 bytes
  Predictor: horizontal differencing 2 (0x2)
En fait, le problème c'est juste que le fichier fpreadtiff.pas est loin d'être fini, concernant "Photometric Interpretation"...
En regardant le pdf des spécifications Tiff 6.0, concernant ce tag, on trouve, page 111 :
et page 117, dans l'annexe :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
TagName				Decimal	Hex	Type	Number of values
PhotometricInterpretation 	262	106	SHORT	1
  WhiteIsZero 			0
  BlackIsZero 			1
  RGB 				2
  RGB Palette 			3
  Transparency mask 		4
  CMYK 				5
  YCbCr 			6
  CIELab 			8
Depuis, le tag n° 9 est apparu :
http://help.accusoft.com/ImagXpress/...pretation.html

et d'autres également, présents dans le /usr/include/tiff.h de ma distribution Linux (pas toute jeune : 3.8.13, ça doit lui faire dans les 4 ans) :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
#define	TIFFTAG_PHOTOMETRIC		262	/* photometric interpretation */
#define	    PHOTOMETRIC_MINISWHITE	0	/* min value is white */
#define	    PHOTOMETRIC_MINISBLACK	1	/* min value is black */
#define	    PHOTOMETRIC_RGB		2	/* RGB color model */
#define	    PHOTOMETRIC_PALETTE		3	/* color map indexed */
#define	    PHOTOMETRIC_MASK		4	/* $holdout mask */
#define	    PHOTOMETRIC_SEPARATED	5	/* !color separations */
#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
#define	    PHOTOMETRIC_CIELAB		8	/* !1976 CIE L*a*b* */
#define	    PHOTOMETRIC_ICCLAB		9	/* ICC L*a*b* [Adobe TIFF Technote 4] */
#define	    PHOTOMETRIC_ITULAB		10	/* ITU L*a*b* */
#define     PHOTOMETRIC_LOGL		32844	/* CIE Log2(L) */
#define     PHOTOMETRIC_LOGLUV		32845	/* CIE Log2(L) (u',v') */
2 fois plus que dans ce misérable fpreadtiff.pas dont la seule différence à ce niveau-là, entre la 2.6.2 et la 3.0, c'est l'ajout d'une condition pour le case 2 (lignes 18x) :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  case IFD.PhotoMetricInterpretation of
  0, 1: if SampleCnt-ExtraSampleCnt<>1 then
    TiffError('gray images expect one sample per pixel, but found '+IntToStr(
      SampleCnt));
  2: if (SampleCnt-ExtraSampleCnt<>3) and (SampleCnt-ExtraSampleCnt<>4) then
    TiffError('rgb(a) images expect three or four samples per pixel, but found '+IntToStr(
      SampleCnt));
  3: if SampleCnt-ExtraSampleCnt<>1 then
    TiffError('palette images expect one sample per pixel, but found '+IntToStr(
      SampleCnt));
  4: if SampleCnt-ExtraSampleCnt<>1 then
    TiffError('mask images expect one sample per pixel, but found '+IntToStr(
      SampleCnt));
  5: if SampleCnt-ExtraSampleCnt<>4 then
    TiffError('cmyk images expect four samples per pixel, but found '+IntToStr(
      SampleCnt));
  end;
La génération de l'erreur que je récupère est faite plus loin (lignes 70x) mais le case de 0 à 5 est le même...

Ceux qui sont dans le secret des dieux pourraient-ils nous dire quand on pourra espérer avoir une version en phase avec le state-of-the-art ?
Merci,