IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

AWT/Swing Java Discussion :

BufferedImage et les espaces de couleurs (ColorSpace)


Sujet :

AWT/Swing Java

  1. #21
    Rédacteur
    Avatar de pseudocode
    Homme Profil pro
    Architecte système
    Inscrit en
    Décembre 2006
    Messages
    10 062
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Architecte système
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2006
    Messages : 10 062
    Points : 16 081
    Points
    16 081
    Par défaut
    Citation Envoyé par Jack Sparrow Voir le message
    Pour sRGB et linearRGB, on a des valeurs pour chaque canaux qui vont de 0 à 255.
    Dans la théorie c'est entre 0 et 1. La quantification intervient après (dépend du nb de bits par composantes).

    La différence étant que certaine zone sont plus étalées dans sRGB (a priori les zones clairs).
    Hum... En fait, on ne peut pas vraiment "comparer". Afficher une image sRGB dans un espace RGB ca n'a pas de sens. Ce sont deux espaces de représentation qui n'ont pas de rapport, si ce n'est le nom des composantes.

    Effectivement, ca fait moins moche d'afficher sRGB dans RGB que dans HSL ou Lab ! Mais normalement, ca ne se fait pas.

    Quand je lis la spéc. de BufferedImage pour get/setRGB, je vois que l'on travaille en fait toujours en sRGB.
    Du coup, ma question est : Quand utilise-t'on le ColorSpace LinearRGB ?
    On doit spécifier le ColorSpace à la création de l'image, pour indiquer le format des données utilisées dans le "Raster" (données lues/ecrites dans le buffer). Les méthodes get/setRGB s'occupent de convertir ces données à la volée en sRGB, qui est le colorspace standard de Java.

    Donc, on peut utiliser le colorSpace LinearRGB si on récupère un buffer dont les données sont des composantes RGB linéaires.

    Par exemple si on récupère un buffer en CIE XYZ et qu'on le convertit en RGB par multiplication de matrice, on obtient des données en RGB linéaires.

    Mais généralement, on transforme "a la main" les données RGB linéaire en sRGB et on stocke tout dans un Raster au format sRGB, afin d'accélérer les accès par get/setRGB (format natif).
    ALGORITHME (n.m.): Méthode complexe de résolution d'un problème simple.

  2. #22
    Membre actif
    Inscrit en
    Juin 2008
    Messages
    189
    Détails du profil
    Informations forums :
    Inscription : Juin 2008
    Messages : 189
    Points : 268
    Points
    268
    Par défaut
    Citation Envoyé par pseudocode Voir le message
    On doit spécifier le ColorSpace à la création de l'image, pour indiquer le format des données utilisées dans le "Raster" (données lues/ecrites dans le buffer). Les méthodes get/setRGB s'occupent de convertir ces données à la volée en sRGB, qui est le colorspace standard de Java.
    ).
    En fait, ça, j'avais bien compris. Mais ma question était plutôt : Pourquoi utiliser un ColorSpace RGB linéaire et qui l'utilise ?
    Dans quel cas est-ce utile ?

  3. #23
    Rédacteur
    Avatar de pseudocode
    Homme Profil pro
    Architecte système
    Inscrit en
    Décembre 2006
    Messages
    10 062
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Architecte système
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2006
    Messages : 10 062
    Points : 16 081
    Points
    16 081
    Par défaut
    Citation Envoyé par Jack Sparrow Voir le message
    En fait, ça, j'avais bien compris. Mais ma question était plutôt : Pourquoi utiliser un ColorSpace RGB linéaire et qui l'utilise ? Dans quel cas est-ce utile ?
    Bah, tu l'utilises si les données "brutes" sont en RGB linéaires

    C'est vrai que ca n'arrive plus très souvent maintenant, la plupart des images a 3 composantes rouge/vert/bleu sont nativement en sRGB (appareils photos, web, ...).

    Il me semble que les vieux formats Apple ou Adobe sont en RGB linéaire, mais ils ne doivent plus être tellement utilisés.
    ALGORITHME (n.m.): Méthode complexe de résolution d'un problème simple.

  4. #24
    Modérateur
    Avatar de ToTo13
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Janvier 2006
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Chercheur en informatique
    Secteur : Santé

    Informations forums :
    Inscription : Janvier 2006
    Messages : 5 793
    Points : 9 860
    Points
    9 860
    Par défaut
    Bonjour,

    merci pour ces précisions.

    Je vais donc utiliser sRGB.

    Je me doutais que l'on pouvait surcharger les méthodes, mais de quels opérateurs parles tu ?
    Et comment les réécrire si je souhaite (et c'est le cas) vraiment utiliser des Double plutôt que des Float ?
    Consignes aux jeunes padawans : une image vaut 1000 mots !
    - Dans ton message respecter tu dois : les règles de rédaction et du forum, prévisualiser, relire et corriger TOUTES les FAUTES (frappes, sms, d'aurteaugrafe, mettre les ACCENTS et les BALISES) => ECRIRE clairement et en Français tu DOIS.
    - Le côté obscur je sens dans le MP => Tous tes MPs je détruirai et la réponse tu n'auras si en privé tu veux que je t'enseigne.(Lis donc ceci)
    - ton poste tu dois marquer quand la bonne réponse tu as obtenu.

  5. #25
    Rédacteur
    Avatar de pseudocode
    Homme Profil pro
    Architecte système
    Inscrit en
    Décembre 2006
    Messages
    10 062
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Architecte système
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2006
    Messages : 10 062
    Points : 16 081
    Points
    16 081
    Par défaut
    Citation Envoyé par ToTo13 Voir le message
    Je me doutais que l'on pouvait surcharger les méthodes, mais de quels opérateurs parles tu ?
    Les classes qui se terminent par "Op" dans le package java.awt.image:
    - RescaleOp
    - ConvolveOp
    - ...

    En gros, a chaque fois que l'image de départ et l'image de destination ne sont pas dans le meme colorspace, ces opérateurs utilisent l'operateur "ColorConvertOp" pour passer par le format "XYZ". Donc ca coute cher.

    Et comment les réécrire si je souhaite (et c'est le cas) vraiment utiliser des Double plutôt que des Float ?
    Il faut créer tes propres implémentations, en implémentant les interface BufferedImageOp et/ou RasterOp.
    ALGORITHME (n.m.): Méthode complexe de résolution d'un problème simple.

  6. #26
    Futur Membre du Club
    Profil pro
    Inscrit en
    Juin 2009
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2009
    Messages : 4
    Points : 5
    Points
    5
    Par défaut Création d'une couleur grâce à un profil ICC
    Citation Envoyé par pseudocode Voir le message
    Pour ton problème, il faut commencer par récupérer une instance de ColorSpace (généralement depuis une instance de ICC_Profile)

    Bonjour,

    C'est exactement ce que j'essaie de faire depuis un moment, sans succès...
    Donc, je profite de ce poste parce que ça n'a pas l'air de vous poser de problèmes à tous les deux.

    Voilà, je voudrais créer une couleur (instance de la classe Color de java) à partir de coordonnées du système CIELab. Donc, j'ai pensé à utiliser un profil ICC. Il me semble que c'est possible mais je n'arrive pas à le mettre en place et je ne trouve AUCUN exemple de code.

    Voici mes essais:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    float[] lab = new float[]{l, a, b};
    File profil = new File(SysColor.class.getResource("Profile_ICC.txt").toURI());
    Color c = new Color(
        new ICC_ColorSpace(ICC_Profile.getInstance(profil.getAbsolutePath())),
        lab,
        1f);

    J'ai téléchargér le profil en question sur le site de l'ICC et je l'ai concaténé avec un entête de profil trouvé sur le même site.
    Voici à quoi ressemble le fichier lu par java (je l'ai coupé un peu pour que ça rentre dans le poste mais il contient bien les 1617 couleurs):
    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
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
    764
    765
    766
    767
    768
    769
    770
    771
    772
    773
    774
    775
    776
    777
    778
    779
    780
    781
    782
    783
    784
    785
    786
    787
    788
    789
    790
    791
    792
    793
    794
    795
    796
    797
    798
    799
    800
    801
    802
    803
    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    816
    817
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    829
    830
    831
    832
    833
    834
    835
    836
    837
    838
    839
    840
    841
    842
    843
    844
    845
    846
    847
    848
    849
    850
    851
    852
    853
    854
    855
    856
    857
    858
    859
    860
    861
    862
    863
    864
    865
    866
    867
    868
    869
    870
    871
    872
    873
    874
    875
    876
    877
    878
    879
    880
    881
    882
    883
    884
    885
    886
    887
    888
    889
    890
    891
    892
    893
    894
    895
    896
    897
    898
    899
    900
    901
    902
    903
    904
    905
    906
    907
    908
    909
    910
    911
    912
    913
    914
    915
    916
    917
    918
    919
    920
    921
    922
    923
    924
    925
    926
    927
    928
    929
    930
    931
    932
    933
    934
    935
    936
    937
    938
    939
    940
    941
    942
    943
    944
    945
    946
    947
    948
    949
    950
    951
    952
    953
    954
    955
    956
    957
    958
    959
    960
    961
    962
    963
    964
    965
    966
    967
    968
    969
    970
    971
    972
    973
    974
    975
    976
    977
    978
    979
    980
    981
    982
    983
    984
    985
    986
    987
    988
    989
    990
    991
    992
    993
    994
    995
    996
    997
    998
    999
    1000
    1001
    1002
    1003
    1004
    1005
    1006
    1007
    1008
    1009
    1010
    1011
    1012
    1013
    1014
    1015
    1016
    1017
    1018
    1019
    1020
    1021
    1022
    1023
    1024
    1025
    1026
    1027
    1028
    1029
    1030
    1031
    1032
    1033
    1034
    1035
    1036
    1037
    1038
    1039
    1040
    1041
    1042
    1043
    1044
    1045
    1046
    1047
    1048
    1049
    1050
    1051
    1052
    1053
    1054
    1055
    1056
    1057
    1058
    1059
    1060
    1061
    1062
    1063
    1064
    1065
    1066
    1067
    1068
    1069
    1070
    1071
    1072
    1073
    1074
    1075
    1076
    1077
    1078
    1079
    1080
    1081
    1082
    1083
    1084
    1085
    1086
    1087
    1088
    1089
    1090
    1091
    1092
    1093
    1094
    1095
    1096
    1097
    1098
    1099
    1100
    1101
    1102
    1103
    1104
    1105
    1106
    1107
    1108
    1109
    1110
    1111
    1112
    1113
    1114
    1115
    1116
    1117
    1118
    1119
    1120
    1121
    1122
    1123
    1124
    1125
    1126
    1127
    1128
    1129
    1130
    1131
    1132
    1133
    1134
    1135
    1136
    1137
    1138
    1139
    1140
    1141
    1142
    /*
        File:       Profile.h
     
        Contains:   ICC profile definitions and structures including Version 4 extensions
     
        Version:    V4
     
        Copyright:  � see below
    */
     
    /* Header file guard bands */
    #ifndef Profile_h
    #define Profile_h
     
    /***************************************************************** 
     Copyright (c) 1994 SunSoft, Inc.
     
                        Rights Reserved
     
    Permission is hereby granted, free of charge, to any person 
    obtaining a copy of this software and associated documentation
    files (the "Software"), to deal in the Software without restrict- 
    ion, including without limitation the rights to use, copy, modify, 
    merge, publish distribute, sublicense, and/or sell copies of the 
    Software, and to permit persons to whom the Software is furnished 
    to do so, subject to the following conditions: 
     
    The above copyright notice and this permission notice shall be 
    included in all copies or substantial portions of the Software. 
     
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
    OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-
    INFRINGEMENT.  IN NO EVENT SHALL SUNSOFT, INC. OR ITS PARENT 
    COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
    OTHER DEALINGS IN THE SOFTWARE. 
     
    Except as contained in this notice, the name of SunSoft, Inc. 
    shall not be used in advertising or otherwise to promote the 
    sale, use or other dealings in this Software without written 
    authorization from SunSoft Inc. 
    ******************************************************************/
     
    /***************************************************************** 
     Copyright (c) 2002  Heidelberger Druckmaschinen AG 
     
     * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
     * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     * DISCLAIMED.  IN NO EVENT SHALL THE INTERNATIONAL COLOR CONSORTIUM OR
     * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
     * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
     * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
     * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     * SUCH DAMAGE.
    ******************************************************************/
     
    /*
     * This version of the header file corresponds to the profile
     * specification version 4.0.
     *
     * All header file entries are pre-fixed with "ic" to help 
     * avoid name space collisions. Signatures are pre-fixed with
     * icSig.
     *
     * The structures defined in this header file were created to
     * represent a description of an ICC profile on disk. Rather
     * than use pointers a technique is used where a single byte array 
     * was placed at the end of each structure. This allows us in "C"
     * to extend the structure by allocating more data than is needed
     * to account for variable length structures.
     *
     * This also ensures that data following is allocated
     * contiguously and makes it easier to write and read data from
     * the file. 
     *
     * For example to allocate space for a 256 count length UCR
     * and BG array, and fill the allocated data.  Note strlen + 1
     * to remember NULL terminator.
     *
            icUcrBgCurve    *ucrCurve, *bgCurve;
            int             ucr_nbytes, bg_nbytes, string_bytes;
            icUcrBg         *ucrBgWrite;
            char            ucr_string[100], *ucr_char;
     
            strcpy(ucr_string, "Example ucrBG curves");
            ucr_nbytes = sizeof(icUInt32Number) + 
                     (UCR_CURVE_SIZE * sizeof(icUInt16Number));
            bg_nbytes = sizeof(icUInt32Number) + 
                     (BG_CURVE_SIZE * sizeof(icUInt16Number));
            string_bytes = strlen(ucr_string) + 1;
     
            ucrBgWrite = (icUcrBg *)malloc(
                                    (ucr_nbytes + bg_nbytes + string_bytes));
     
            ucrCurve = (icUcrBgCurve *)ucrBgWrite->data;
            ucrCurve->count = UCR_CURVE_SIZE;
            for (i=0; i<ucrCurve->count; i++)
                    ucrCurve->curve[i] = (icUInt16Number)i;
     
            bgCurve = (icUcrBgCurve *)((char *)ucrCurve + ucr_nbytes);
            bgCurve->count = BG_CURVE_SIZE;
            for (i=0; i<bgCurve->count; i++)
                    bgCurve->curve[i] = 255 - (icUInt16Number)i;
     
            ucr_char = (char *)((char *)bgCurve + bg_nbytes);
            memcpy(ucr_char, ucr_string, string_bytes);
     *
     */
     
    /*
     * Many of the structures contain variable length arrays. This
     * is represented by the use of the convention.
     *
     *      type    data[icAny];
     */
     
    /*------------------------------------------------------------------------*/
    /*
     * Defines used in the specification
     */
    #define icMagicNumber                   0x61637370L     /* 'acsp' */
    #define icVersionNumber                 0x02100000L     /* 2.1, BCD */
    #define icVersionNumberV4               0x04000000L     /* 4.0, BCD */
     
    /* Screening Encodings */
    #define icPrtrDefaultScreensFalse       0x00000000L     /* Bit position 0 */
    #define icPrtrDefaultScreensTrue        0x00000001L     /* Bit position 0 */
    #define icLinesPerInch                  0x00000002L     /* Bit position 1 */
    #define icLinesPerCm                    0x00000000L     /* Bit position 1 */
     
    /* 
     * Device attributes, currently defined values correspond
     * to the low 4 bytes of the 8 byte attribute quantity, see
     * the header for their location.
     */
    #define icReflective                    0x00000000L     /* Bit position 0 */
    #define icTransparency                  0x00000001L     /* Bit position 0 */
    #define icGlossy                        0x00000000L     /* Bit position 1 */
    #define icMatte                         0x00000002L     /* Bit position 1 */
     
    /*
     * Profile header flags, the low 16 bits are reserved for consortium
     * use.
     */
    #define icEmbeddedProfileFalse          0x00000000L     /* Bit position 0 */
    #define icEmbeddedProfileTrue           0x00000001L     /* Bit position 0 */
    #define icUseAnywhere                   0x00000000L     /* Bit position 1 */
    #define icUseWithEmbeddedDataOnly       0x00000002L     /* Bit position 1 */
     
    /* Ascii or Binary data */
    #define icAsciiData                     0x00000000L     /* Used in dataType */
    #define icBinaryData                    0x00000001L
     
    /* 
     * Define used to indicate that this is a variable length array
     */
    #define icAny                               1
     
    /*
     * Number definitions
     */
     
    /* Unsigned integer numbers */
    typedef unsigned char       icUInt8Number;
    typedef unsigned short      icUInt16Number;
    typedef unsigned long       icUInt32Number;
    typedef unsigned long       icUInt64Number[2];
     
    typedef icUInt32Number      icSignature;
     
    /* Signed numbers */
    typedef char                icInt8Number;
    typedef short               icInt16Number;
    typedef long                icInt32Number;
    typedef long                icInt64Number[2];
     
    /* Fixed numbers */
    typedef icInt32Number       icS15Fixed16Number;
    typedef icUInt32Number      icU16Fixed16Number;
     
    /*------------------------------------------------------------------------*/
    /* public tags and sizes */
    typedef enum {
        icSigAToB0Tag                       = 0x41324230L,  /* 'A2B0' */ 
        icSigAToB1Tag                       = 0x41324231L,  /* 'A2B1' */
        icSigAToB2Tag                       = 0x41324232L,  /* 'A2B2' */ 
        icSigBlueColorantTag                = 0x6258595AL,  /* 'bXYZ' */
        icSigBlueTRCTag                     = 0x62545243L,  /* 'bTRC' */
        icSigBToA0Tag                       = 0x42324130L,  /* 'B2A0' */
        icSigBToA1Tag                       = 0x42324131L,  /* 'B2A1' */
        icSigBToA2Tag                       = 0x42324132L,  /* 'B2A2' */
        icSigCalibrationDateTimeTag         = 0x63616C74L,  /* 'calt' */
        icSigCharTargetTag                  = 0x74617267L,  /* 'targ' */ 
        icSigCopyrightTag                   = 0x63707274L,  /* 'cprt' */
        icSigCrdInfoTag                     = 0x63726469L,  /* 'crdi' */
        icSigDeviceMfgDescTag               = 0x646D6E64L,  /* 'dmnd' */
        icSigDeviceModelDescTag             = 0x646D6464L,  /* 'dmdd' */
        icSigGamutTag                       = 0x67616D74L,  /* 'gamt ' */
        icSigGrayTRCTag                     = 0x6b545243L,  /* 'kTRC' */
        icSigGreenColorantTag               = 0x6758595AL,  /* 'gXYZ' */
        icSigGreenTRCTag                    = 0x67545243L,  /* 'gTRC' */
        icSigLuminanceTag                   = 0x6C756d69L,  /* 'lumi' */
        icSigMeasurementTag                 = 0x6D656173L,  /* 'meas' */
        icSigMediaBlackPointTag             = 0x626B7074L,  /* 'bkpt' */
        icSigMediaWhitePointTag             = 0x77747074L,  /* 'wtpt' */
        /*icSigNamedColorTag                  = 0x6E636f6CL,  / 'ncol' 
                                                             * OBSOLETE, use ncl2 */
        icSigNamedColor2Tag                 = 0x6E636C32L,  /* 'ncl2' */
        icSigPreview0Tag                    = 0x70726530L,  /* 'pre0' */
        icSigPreview1Tag                    = 0x70726531L,  /* 'pre1' */
        icSigPreview2Tag                    = 0x70726532L,  /* 'pre2' */
        icSigProfileDescriptionTag          = 0x64657363L,  /* 'desc' */
        icSigProfileSequenceDescTag         = 0x70736571L,  /* 'pseq' */
        icSigPs2CRD0Tag                     = 0x70736430L,  /* 'psd0' */
        icSigPs2CRD1Tag                     = 0x70736431L,  /* 'psd1' */
        icSigPs2CRD2Tag                     = 0x70736432L,  /* 'psd2' */
        icSigPs2CRD3Tag                     = 0x70736433L,  /* 'psd3' */
        icSigPs2CSATag                      = 0x70733273L,  /* 'ps2s' */
        icSigPs2RenderingIntentTag          = 0x70733269L,  /* 'ps2i' */
        icSigRedColorantTag                 = 0x7258595AL,  /* 'rXYZ' */
        icSigRedTRCTag                      = 0x72545243L,  /* 'rTRC' */
        icSigScreeningDescTag               = 0x73637264L,  /* 'scrd' */
        icSigScreeningTag                   = 0x7363726EL,  /* 'scrn' */
        icSigTechnologyTag                  = 0x74656368L,  /* 'tech' */
        icSigUcrBgTag                       = 0x62666420L,  /* 'bfd ' */
        icSigViewingCondDescTag             = 0x76756564L,  /* 'vued' */
        icSigViewingConditionsTag           = 0x76696577L,  /* 'view' */
        icSigColorantOrderTag               = 0x636C726FL,  /* 'clro' */
        icSigColorantTableTag               = 0x636C7274L,  /* 'clrt' */
        icSigChromaticAdaptationTag         = 0x63686164L,  /* 'chad' */
        icSigColorantTableOutTag		= 0x636C6F74L,	/* 'clot' */
        icMaxEnumTag                        = 0xFFFFFFFFL
    } icTagSignature;
     
    /* technology signature descriptions */
    typedef enum {
        icSigDigitalCamera                  = 0x6463616DL,  /* 'dcam' */
        icSigFilmScanner                    = 0x6673636EL,  /* 'fscn' */
        icSigReflectiveScanner              = 0x7273636EL,  /* 'rscn' */
        icSigInkJetPrinter                  = 0x696A6574L,  /* 'ijet' */ 
        icSigThermalWaxPrinter              = 0x74776178L,  /* 'twax' */
        icSigElectrophotographicPrinter     = 0x6570686FL,  /* 'epho' */
        icSigElectrostaticPrinter           = 0x65737461L,  /* 'esta' */
        icSigDyeSublimationPrinter          = 0x64737562L,  /* 'dsub' */
        icSigPhotographicPaperPrinter       = 0x7270686FL,  /* 'rpho' */
        icSigFilmWriter                     = 0x6670726EL,  /* 'fprn' */
        icSigVideoMonitor                   = 0x7669646DL,  /* 'vidm' */
        icSigVideoCamera                    = 0x76696463L,  /* 'vidc' */
        icSigProjectionTelevision           = 0x706A7476L,  /* 'pjtv' */
        icSigCRTDisplay                     = 0x43525420L,  /* 'CRT ' */
        icSigPMDisplay                      = 0x504D4420L,  /* 'PMD ' */
        icSigAMDisplay                      = 0x414D4420L,  /* 'AMD ' */
        icSigPhotoCD                        = 0x4B504344L,  /* 'KPCD' */
        icSigPhotoImageSetter               = 0x696D6773L,  /* 'imgs' */
        icSigGravure                        = 0x67726176L,  /* 'grav' */
        icSigOffsetLithography              = 0x6F666673L,  /* 'offs' */
        icSigSilkscreen                     = 0x73696C6BL,  /* 'silk' */
        icSigFlexography                    = 0x666C6578L,  /* 'flex' */
        icMaxEnumTechnology                 = 0xFFFFFFFFL
    } icTechnologySignature;
     
    /* type signatures */
    typedef enum {
        icSigCurveType                      = 0x63757276L,  /* 'curv' */
        icSigDataType                       = 0x64617461L,  /* 'data' */
        icSigDateTimeType                   = 0x6474696DL,  /* 'dtim' */
        icSigLut16Type                      = 0x6d667432L,  /* 'mft2' */
        icSigLut8Type                       = 0x6d667431L,  /* 'mft1' */
        icSigMeasurementType                = 0x6D656173L,  /* 'meas' */
        /*icSigNamedColorType                 = 0x6E636f6CL,  / 'ncol' 
                                                             * OBSOLETE, use ncl2 */
        icSigProfileSequenceDescType        = 0x70736571L,  /* 'pseq' */
        icSigS15Fixed16ArrayType            = 0x73663332L,  /* 'sf32' */
        icSigScreeningType                  = 0x7363726EL,  /* 'scrn' */
        icSigSignatureType                  = 0x73696720L,  /* 'sig ' */
        icSigTextType                       = 0x74657874L,  /* 'text' */
        icSigTextDescriptionType            = 0x64657363L,  /* 'desc' */
        icSigU16Fixed16ArrayType            = 0x75663332L,  /* 'uf32' */
        icSigUcrBgType                      = 0x62666420L,  /* 'bfd ' */
        icSigUInt16ArrayType                = 0x75693136L,  /* 'ui16' */
        icSigUInt32ArrayType                = 0x75693332L,  /* 'ui32' */
        icSigUInt64ArrayType                = 0x75693634L,  /* 'ui64' */
        icSigUInt8ArrayType                 = 0x75693038L,  /* 'ui08' */
        icSigViewingConditionsType          = 0x76696577L,  /* 'view' */
        icSigXYZType                        = 0x58595A20L,  /* 'XYZ ' */
        icSigXYZArrayType                   = 0x58595A20L,  /* 'XYZ ' */
        icSigNamedColor2Type                = 0x6E636C32L,  /* 'ncl2' */
        icSigCrdInfoType                    = 0x63726469L,  /* 'crdi' */
        icSigColorantOrderType              = 0x636C726FL,  /* 'clro' */
        icSigColorantTableType              = 0x636C7274L,  /* 'clrt' */
        icSigChromaticAdaptationType        = 0x63686164L,  /* 'chad' */
        icSiglutAtoBType                    = 0x6d414220L,  /* 'mAB ' */
        icSiglutBtoAType                    = 0x6d424120L,  /* 'mBA ' */
        icSigParametricCurveType            = 0x70617261L,  /* 'para' */
        icMaxEnumType                       = 0xFFFFFFFFL
    } icTagTypeSignature;
     
    /* 
     * Color Space Signatures
     * Note that only icSigXYZData and icSigLabData are valid
     * Profile Connection Spaces (PCSs)
     */ 
    typedef enum {
        icSigXYZData                        = 0x58595A20L,  /* 'XYZ ' */
        icSigLabData                        = 0x4C616220L,  /* 'Lab ' */
        icSigLuvData                        = 0x4C757620L,  /* 'Luv ' */
        icSigYCbCrData                      = 0x59436272L,  /* 'YCbr' */
        icSigYxyData                        = 0x59787920L,  /* 'Yxy ' */
        icSigRgbData                        = 0x52474220L,  /* 'RGB ' */
        icSigGrayData                       = 0x47524159L,  /* 'GRAY' */
        icSigHsvData                        = 0x48535620L,  /* 'HSV ' */
        icSigHlsData                        = 0x484C5320L,  /* 'HLS ' */
        icSigCmykData                       = 0x434D594BL,  /* 'CMYK' */
        icSigCmyData                        = 0x434D5920L,  /* 'CMY ' */
     
        icSigMCH1Data                       = 0x31434C52L,  /* '1CLR' */        
        icSigMCH2Data                       = 0x32434C52L,  /* '2CLR' */        
        icSigMCH3Data                       = 0x33434C52L,  /* '3CLR' */        
        icSigMCH4Data                       = 0x34434C52L,  /* '4CLR' */        
        icSigMCH5Data                       = 0x35434C52L,  /* '5CLR' */
        icSigMCH6Data                       = 0x36434C52L,  /* '6CLR' */
        icSigMCH7Data                       = 0x37434C52L,  /* '7CLR' */
        icSigMCH8Data                       = 0x38434C52L,  /* '8CLR' */
        icSigMCH9Data                       = 0x39434C52L,  /* '9CLR' */
        icSigMCHAData                       = 0x41434C52L,  /* 'ACLR' */
        icSigMCHBData                       = 0x42434C52L,  /* 'BCLR' */
        icSigMCHCData                       = 0x43434C52L,  /* 'CCLR' */
        icSigMCHDData                       = 0x44434C52L,  /* 'DCLR' */
        icSigMCHEData                       = 0x45434C52L,  /* 'ECLR' */
        icSigMCHFData                       = 0x46434C52L,  /* 'FCLR' */
        icSigMCHGData                       = 0x47434C52L,  /* 'GCLR' */
        icSigNamedData                      = 0x6e6d636cL,  /* 'nmcl' */
     
        icSig1colorData                     = 0x31434C52L,  /* '1CLR' */
        icSig2colorData                     = 0x32434C52L,  /* '2CLR' */
        icSig3colorData                     = 0x33434C52L,  /* '3CLR' */
        icSig4colorData                     = 0x34434C52L,  /* '4CLR' */
        icSig5colorData                     = 0x35434C52L,  /* '5CLR' */
        icSig6colorData                     = 0x36434C52L,  /* '6CLR' */
        icSig7colorData                     = 0x37434C52L,  /* '7CLR' */
        icSig8colorData                     = 0x38434C52L,  /* '8CLR' */
        icSig9colorData                     = 0x39434C52L,  /* '9CLR' */
        icSig10colorData                    = 0x41434C52L,  /* 'ACLR' */
        icSig11colorData                    = 0x42434C52L,  /* 'BCLR' */
        icSig12colorData                    = 0x43434C52L,  /* 'CCLR' */
        icSig13colorData                    = 0x44434C52L,  /* 'DCLR' */
        icSig14colorData                    = 0x45434C52L,  /* 'ECLR' */
        icSig15colorData                    = 0x46434C52L,  /* 'FCLR' */
        icSig16colorData                    = 0x47434C52L,  /* 'GCLR' */
     
        icMaxEnumData                       = 0xFFFFFFFFL
    } icColorSpaceSignature;
     
    /* profileClass enumerations */
    typedef enum {
        icSigInputClass                     = 0x73636E72L,  /* 'scnr' */
        icSigDisplayClass                   = 0x6D6E7472L,  /* 'mntr' */
        icSigOutputClass                    = 0x70727472L,  /* 'prtr' */
        icSigLinkClass                      = 0x6C696E6BL,  /* 'link' */
        icSigAbstractClass                  = 0x61627374L,  /* 'abst' */
        icSigColorSpaceClass                = 0x73706163L,  /* 'spac' */
        icSigNamedColorClass                = 0x6e6d636cL,  /* 'nmcl' */
        icMaxEnumClass                      = 0xFFFFFFFFL
    } icProfileClassSignature;
     
    /* Platform Signatures */
    typedef enum {
        icSigMacintosh                      = 0x4150504CL,  /* 'APPL' */
        icSigMicrosoft                      = 0x4D534654L,  /* 'MSFT' */
        icSigSolaris                        = 0x53554E57L,  /* 'SUNW' */
        icSigSGI                            = 0x53474920L,  /* 'SGI ' */
        icSigTaligent                       = 0x54474E54L,  /* 'TGNT' */
        icMaxEnumPlatform                   = 0xFFFFFFFFL
    } icPlatformSignature;
     
    /*------------------------------------------------------------------------*/
    /*
     * Other enums
     */
     
    /* Measurement Flare, used in the measurmentType tag */
    typedef enum {
        icFlare0                            = 0x00000000L,  /* 0% flare */
        icFlare100                          = 0x00000001L,  /* 100% flare */
        icMaxFlare                          = 0xFFFFFFFFL
    } icMeasurementFlare;
     
    /* Measurement Geometry, used in the measurmentType tag */
    typedef enum {
        icGeometryUnknown                   = 0x00000000L,  /* Unknown geometry */
        icGeometry045or450                  = 0x00000001L,  /* 0/45, 45/0 */
        icGeometry0dord0                    = 0x00000002L,  /* 0/d or d/0 */
        icMaxGeometry                       = 0xFFFFFFFFL
    } icMeasurementGeometry;
     
    /* Rendering Intents, used in the profile header */
    typedef enum {
        icPerceptual                        = 0,
        icRelativeColorimetric              = 1,
        icSaturation                        = 2,
        icAbsoluteColorimetric              = 3,
        icMaxEnumIntent                     = 0xFFFFFFFFL
    } icRenderingIntent;
     
    /* Different Spot Shapes currently defined, used for screeningType */
    typedef enum {
        icSpotShapeUnknown                  = 0,
        icSpotShapePrinterDefault           = 1,
        icSpotShapeRound                    = 2,
        icSpotShapeDiamond                  = 3,
        icSpotShapeEllipse                  = 4,
        icSpotShapeLine                     = 5,
        icSpotShapeSquare                   = 6,
        icSpotShapeCross                    = 7,
        icMaxEnumSpot                       = 0xFFFFFFFFL
    } icSpotShape;
     
    /* Standard Observer, used in the measurmentType tag */
    typedef enum {
        icStdObsUnknown                     = 0x00000000L,  /* Unknown observer */
        icStdObs1931TwoDegrees              = 0x00000001L,  /* 1931 two degrees */
        icStdObs1964TenDegrees              = 0x00000002L,  /* 1961 ten degrees */
        icMaxStdObs                         = 0xFFFFFFFFL
    } icStandardObserver;
     
    /* Pre-defined illuminants, used in measurement and viewing conditions type */
    typedef enum {
        icIlluminantUnknown                 = 0x00000000L,
        icIlluminantD50                     = 0x00000001L,
        icIlluminantD65                     = 0x00000002L,
        icIlluminantD93                     = 0x00000003L,
        icIlluminantF2                      = 0x00000004L,
        icIlluminantD55                     = 0x00000005L,
        icIlluminantA                       = 0x00000006L,
        icIlluminantEquiPowerE              = 0x00000007L,  /* Equi-Power (E) */
        icIlluminantF8                      = 0x00000008L,      
        icMaxEnumIluminant                  = 0xFFFFFFFFL
    } icIlluminant;
     
     
    /*------------------------------------------------------------------------*/
    /*
     * Arrays of numbers 
     */
     
    /* Int8 Array */
    typedef struct {
        icInt8Number        data[icAny];    /* Variable array of values */
    } icInt8Array;
     
    /* UInt8 Array */
    typedef struct {
        icUInt8Number       data[icAny];    /* Variable array of values */
    } icUInt8Array;
     
    /* uInt16 Array */
    typedef struct {
        icUInt16Number      data[icAny];    /* Variable array of values */
    } icUInt16Array;
     
    /* Int16 Array */
    typedef struct {
        icInt16Number       data[icAny];    /* Variable array of values */
    } icInt16Array;
     
    /* uInt32 Array */
    typedef struct {
        icUInt32Number      data[icAny];    /* Variable array of values */
    } icUInt32Array;
     
    /* Int32 Array */
    typedef struct {
        icInt32Number       data[icAny];    /* Variable array of values */
    } icInt32Array;
     
    /* UInt64 Array */
    typedef struct {
        icUInt64Number      data[icAny];    /* Variable array of values */
    } icUInt64Array;
     
    /* Int64 Array */
    typedef struct {
        icInt64Number       data[icAny];    /* Variable array of values */
    } icInt64Array;
     
    /* u16Fixed16 Array */
    typedef struct {
        icU16Fixed16Number  data[icAny];    /* Variable array of values */
    } icU16Fixed16Array;
     
    /* s15Fixed16 Array */
    typedef struct {
        icS15Fixed16Number  data[icAny];    /* Variable array of values */
    } icS15Fixed16Array;
     
    /* The base date time number */
    typedef struct {
        icUInt16Number      year;
        icUInt16Number      month;
        icUInt16Number      day;
        icUInt16Number      hours;
        icUInt16Number      minutes;
        icUInt16Number      seconds;
    } icDateTimeNumber;
     
    /* XYZ Number  */
    typedef struct {
        icS15Fixed16Number  X;
        icS15Fixed16Number  Y;
        icS15Fixed16Number  Z;
    } icXYZNumber;
     
    /* XYZ Array */
    typedef struct {
        icXYZNumber         data[icAny];    /* Variable array of XYZ numbers */
    } icXYZArray;
     
    /* Curve */
    typedef struct {
        icUInt32Number      count;          /* Number of entries */
        icUInt16Number      data[icAny];    /* The actual table data, real
                                             * number is determined by count
                                             * Interpretation depends on how
                                             * data is used with a given tag
                                             */
    } icCurve;
     
    /* Curve */
    typedef struct {
        icUInt16Number      funcType;       /* Function Type                */
                                            /* 0 = gamma only               */
        icUInt16Number      pad;            /* Padding for byte alignment   */
        icS15Fixed16Number  gamma;          /* x�gamma                      */
                                            /* up to 7 values Y,a,b,c,d,e,f */
    } icParametricCurve;
     
    typedef struct {
        icUInt16Number      funcType;       /* Function Type                */
                                            /* 0 = gamma only               */
        icUInt16Number      pad;            /* Padding for byte alignment   */
        icS15Fixed16Number  gamma;          /* x�gamma                      */
        icS15Fixed16Number  a;              /* a                            */
        icS15Fixed16Number  b;              /* b                            */
        icS15Fixed16Number  c;              /* c                            */
        icS15Fixed16Number  d;              /* d                            */
        icS15Fixed16Number  e;              /* e                            */
        icS15Fixed16Number  f;              /* f                            */
    } icParametricCurveFull;
     
    /* Data */
    typedef struct {
        icUInt32Number      dataFlag;       /* 0 = ascii, 1 = binary */
        icInt8Number        data[icAny];    /* Data, size determined from tag */
    } icData;
     
    /* lut16 */
    typedef struct {
        icUInt8Number       inputChan;      /* Number of input channels */
        icUInt8Number       outputChan;     /* Number of output channels */
        icUInt8Number       clutPoints;     /* Number of clutTable grid points */
        icInt8Number        pad;            /* Padding for byte alignment */
        icS15Fixed16Number  e00;            /* e00 in the 3 * 3 */
        icS15Fixed16Number  e01;            /* e01 in the 3 * 3 */    
        icS15Fixed16Number  e02;            /* e02 in the 3 * 3 */
        icS15Fixed16Number  e10;            /* e10 in the 3 * 3 */
        icS15Fixed16Number  e11;            /* e11 in the 3 * 3 */    
        icS15Fixed16Number  e12;            /* e12 in the 3 * 3 */ 
        icS15Fixed16Number  e20;            /* e20 in the 3 * 3 */
        icS15Fixed16Number  e21;            /* e21 in the 3 * 3 */    
        icS15Fixed16Number  e22;            /* e22 in the 3 * 3 */
        icUInt16Number      inputEnt;       /* Number of input table entries */
        icUInt16Number      outputEnt;      /* Number of output table entries */
        icUInt16Number      data[icAny];    /* Data follows see spec for size */
    /*
     *  Data that follows is of this form
     *
     *  icUInt16Number      inputTable[inputChan][icAny];   * The input table
     *  icUInt16Number      clutTable[icAny];               * The clut table
     *  icUInt16Number      outputTable[outputChan][icAny]; * The output table
     */
    } icLut16;
     
    /* lut8, input & output tables are always 256 bytes in length */
    typedef struct {
        icUInt8Number       inputChan;      /* Number of input channels */
        icUInt8Number       outputChan;     /* Number of output channels */
        icUInt8Number       clutPoints;     /* Number of clutTable grid points */
        icInt8Number        pad;
        icS15Fixed16Number  e00;            /* e00 in the 3 * 3 */
        icS15Fixed16Number  e01;            /* e01 in the 3 * 3 */    
        icS15Fixed16Number  e02;            /* e02 in the 3 * 3 */
        icS15Fixed16Number  e10;            /* e10 in the 3 * 3 */
        icS15Fixed16Number  e11;            /* e11 in the 3 * 3 */    
        icS15Fixed16Number  e12;            /* e12 in the 3 * 3 */ 
        icS15Fixed16Number  e20;            /* e20 in the 3 * 3 */
        icS15Fixed16Number  e21;            /* e21 in the 3 * 3 */    
        icS15Fixed16Number  e22;            /* e22 in the 3 * 3 */
        icUInt8Number       data[icAny];    /* Data follows see spec for size */
    /*
     *  Data that follows is of this form
     *
     *  icUInt8Number       inputTable[inputChan][256];     * The input table
     *  icUInt8Number       clutTable[icAny];               * The clut table
     *  icUInt8Number       outputTable[outputChan][256];   * The output table
     */
    } icLut8;
     
    /* icLutAToB  */
    typedef struct {
        icUInt8Number       gridPoints[16]; /* Number of grid points in each dimension.  */
        icUInt8Number       prec;           /* Precision of data elements in bytes.      */
        icUInt8Number       pad1;
        icUInt8Number       pad2;
        icUInt8Number       pad3;
        /*icUInt8Number     data[icAny];     Data follows see spec for size */
    } icCLutStruct;
     
    /* icLutAtoB  */
    typedef struct {
        icUInt8Number       inputChan;      /* Number of input channels     */
        icUInt8Number       outputChan;     /* Number of output channels    */
        icUInt8Number       pad1;
        icUInt8Number       pad2;
        icUInt32Number      offsetB;        /* Offset to first "B" curve    */
        icUInt32Number      offsetMat;      /* Offset to matrix             */
        icUInt32Number      offsetM;        /* Offset to first "M" curve    */
        icUInt32Number      offsetC;        /* Offset to CLUT               */
        icUInt32Number      offsetA;        /* Offset to first "A" curve    */
        /*icUInt8Number     data[icAny];     Data follows see spec for size */
    } icLutAtoB;
     
    /* icLutBtoA  */
    typedef struct {
        icUInt8Number       inputChan;      /* Number of input channels     */
        icUInt8Number       outputChan;     /* Number of output channels    */
        icUInt8Number       pad1;
        icUInt8Number       pad2;
        icUInt32Number      offsetB;        /* Offset to first "B" curve    */
        icUInt32Number      offsetMat;      /* Offset to matrix             */
        icUInt32Number      offsetM;        /* Offset to first "M" curve    */
        icUInt32Number      offsetC;        /* Offset to CLUT               */
        icUInt32Number      offsetA;        /* Offset to first "A" curve    */
        /*icUInt8Number     data[icAny];     Data follows see spec for size */
    } icLutBtoA;
     
    /* Measurement Data */
    typedef struct {
        icStandardObserver          stdObserver;    /* Standard observer */
        icXYZNumber                 backing;        /* XYZ for backing material */
        icMeasurementGeometry       geometry;       /* Measurement geometry */
        icMeasurementFlare          flare;          /* Measurement flare */
        icIlluminant                illuminant;     /* Illuminant */
    } icMeasurement;
     
    /* Named color */
     
    /*
     * icNamedColor2 takes the place of icNamedColor
     */
    typedef struct {
        icUInt32Number      vendorFlag;     /* Bottom 16 bits for IC use */
        icUInt32Number      count;          /* Count of named colors */
        icUInt32Number      nDeviceCoords;  /* Number of device coordinates */
        icInt8Number        prefix[32];     /* Prefix for each color name */
        icInt8Number        suffix[32];     /* Suffix for each color name */
        icInt8Number        data[icAny];    /* Named color data follows */
    /*
     *  Data that follows is of this form
     *
     * icInt8Number         root1[32];              * Root name for first color
     * icUInt16Number       pcsCoords1[icAny];      * PCS coordinates of first color
     * icUInt16Number       deviceCoords1[icAny];   * Device coordinates of first color
     * icInt8Number         root2[32];              * Root name for second color
     * icUInt16Number       pcsCoords2[icAny];      * PCS coordinates of first color
     * icUInt16Number       deviceCoords2[icAny];   * Device coordinates of first color
     *                      :
     *                      :
     * Repeat for name and PCS and device color coordinates up to (count-1)
     * 
     * NOTES:  
     * PCS and device space can be determined from the header.
     *
     * PCS coordinates are icUInt16 numbers and are described in Annex A of 
     * the ICC spec. Only 16 bit L*a*b* and XYZ are allowed. The number of 
     * coordinates is consistent with the headers PCS.
     *
     * Device coordinates are icUInt16 numbers where 0x0000 represents
     * the minimum value and 0xFFFF represents the maximum value. 
     * If the nDeviceCoords value is 0 this field is not given.
     */
    } icNamedColor2;
     
    /* Profile sequence structure */
    typedef struct {
        icSignature                 deviceMfg;      /* Device Manufacturer */
        icSignature                 deviceModel;    /* Decvice Model */
        icUInt64Number              attributes;     /* Device attributes */
        icTechnologySignature       technology;     /* Technology signature */
        icInt8Number                data[icAny];    /* Descriptions text follows */
    /*
     *  Data that follows is of this form, this is an icInt8Number
     *  to avoid problems with a compiler generating  bad code as 
     *  these arrays are variable in length.
     *
     * icTextDescription            deviceMfgDesc;  * Manufacturer text
     * icTextDescription            modelDesc;      * Model text
     */
    } icDescStruct;
     
    /* Profile sequence description */
    typedef struct {
        icUInt32Number      count;          /* Number of descriptions */
        icUInt8Number       data[icAny];    /* Array of description struct */
    } icProfileSequenceDesc;
     
    /* textDescription */
    typedef struct {
        icUInt32Number      count;          /* Description length */
        icInt8Number        data[icAny];    /* Descriptions follow */
    /*
     *  Data that follows is of this form
     *
     * icInt8Number         desc[count]     * NULL terminated ascii string
     * icUInt32Number       ucLangCode;     * UniCode language code
     * icUInt32Number       ucCount;        * UniCode description length
     * icInt16Number        ucDesc[ucCount];* The UniCode description
     * icUInt16Number       scCode;         * ScriptCode code
     * icUInt8Number        scCount;        * ScriptCode count
     * icInt8Number         scDesc[67];     * ScriptCode Description
     */
    } icTextDescription;
     
    /* Screening Data */
    typedef struct {
        icS15Fixed16Number  frequency;      /* Frequency */
        icS15Fixed16Number  angle;          /* Screen angle */
        icSpotShape         spotShape;      /* Spot Shape encodings below */
    } icScreeningData;
     
    typedef struct {
        icUInt32Number      screeningFlag;  /* Screening flag */
        icUInt32Number      channels;       /* Number of channels */
        icScreeningData     data[icAny];    /* Array of screening data */
    } icScreening;
     
    /* Text Data */
    typedef struct {
        icInt8Number        data[icAny];    /* Variable array of characters */
    } icText;
     
    /* Structure describing either a UCR or BG curve */
    typedef struct {
        icUInt32Number      count;          /* Curve length */
        icUInt16Number      curve[icAny];   /* The array of curve values */
    } icUcrBgCurve;
     
    /* Under color removal, black generation */
    typedef struct {
        icInt8Number        data[icAny];    /* The Ucr BG data */
    /*
     *  Data that follows is of this form, this is a icInt8Number
     *  to avoid problems with a compiler generating  bad code as 
     *  these arrays are variable in length.
     *
     * icUcrBgCurve         ucr;            * Ucr curve
     * icUcrBgCurve         bg;             * Bg curve
     * icInt8Number         string;         * UcrBg description
     */
    } icUcrBg;
     
    /* viewingConditionsType */
    typedef struct {
        icXYZNumber         illuminant;     /* In candelas per metre sq'd */
        icXYZNumber         surround;       /* In candelas per metre sq'd */
        icIlluminant        stdIluminant;   /* See icIlluminant defines */
    } icViewingCondition;
     
    /* CrdInfo type */
    typedef struct {
        icUInt32Number      count;          /* Char count includes NULL */
        icInt8Number        desc[icAny];    /* Null terminated string */
    } icCrdInfo;
     
    /* ColorantOrder type */
    typedef struct {
        icUInt32Number      count;          /* Count of colorants           */
        icInt8Number        data[icAny];    /* One-based number of the 
                                               colorant to be printed first,
                                               second...                    */
    } icColorantOrder;
     
    /* ColorantTable */
    typedef struct {
        icInt8Number        name[32];       /* First colorant name              */
        icInt16Number       data[3];        /* 16 bit PCS Lab value for first   */
    } icColorantTableEntry;
    typedef struct {
        icUInt32Number          count;          /* Count of colorants           */
        icColorantTableEntry    entry[icAny];   /* N colorant entries           */
    } icColorantTable;
     
    /*------------------------------------------------------------------------*/
    /*
     * Tag Type definitions
     */
     
    /*
     * Many of the structures contain variable length arrays. This
     * is represented by the use of the convention.
     *
     *      type    data[icAny];
     */
     
    /* The base part of each tag */
    typedef struct {
        icTagTypeSignature  sig;            /* Signature */
        icInt8Number        reserved[4];    /* Reserved, set to 0 */
    } icTagBase;
     
    /* curveType */
    typedef struct {
        icTagBase           base;           /* Signature, "curv" */
        icCurve             curve;          /* The curve data */
    } icCurveType;
     
    /* ParametricCurveType */
    typedef struct {
        icTagBase           base;           /* Signature, "para"        */
        icParametricCurve   curve;          /* The Parametric curve data*/
    } icParametricCurveType;
     
    /* ParametricCurveFullType */
    typedef struct {
        icTagBase           base;           /* Signature, "para"        */
        icParametricCurveFull curve;        /* The Parametric curve data*/
    } icParametricCurveFullType;
     
    /* dataType */
    typedef struct {
        icTagBase           base;           /* Signature, "data" */
        icData              data;           /* The data structure */
    } icDataType;
     
    /* dateTimeType */
    typedef struct {
        icTagBase           base;           /* Signature, "dtim" */
        icDateTimeNumber    date;           /* The date */
    } icDateTimeType;
     
    /* lut16Type */
    typedef struct {
        icTagBase           base;           /* Signature, "mft2" */
        icLut16             lut;            /* Lut16 data */
    } icLut16Type;
     
    /* lut8Type, input & output tables are always 256 bytes in length */
    typedef struct {
        icTagBase           base;           /* Signature, "mft1" */
        icLut8              lut;            /* Lut8 data */
    } icLut8Type;
     
    /* lutAtoBType new format */
    typedef struct {
        icTagBase           base;           /* Signature, "mAB " */
        icLutAtoB           lut;            /* icLutAtoB data    */
    } icLutAtoBType;
     
    /* lutBtoAType new format */
    typedef struct {
        icTagBase           base;           /* Signature, "mBA " */
        icLutBtoA           lut;            /* icLutBtoA data    */
    } icLutBtoAType;
     
    /* Measurement Type */
    typedef struct {
        icTagBase           base;           /* Signature, "meas" */
        icMeasurement       measurement;    /* Measurement data  */
    } icMeasurementType;
     
    /* Named color type */
    /* icNamedColor2Type, replaces icNamedColorType */
    typedef struct {
        icTagBase           base;           /* Signature, "ncl2" */
        icNamedColor2       ncolor;         /* Named color data  */
    } icNamedColor2Type;
     
    /* Profile sequence description type */
    typedef struct {
        icTagBase               base;       /* Signature, "pseq" */
        icProfileSequenceDesc   desc;       /* The seq description */
    } icProfileSequenceDescType;
     
    /* textDescriptionType */
    typedef struct {
        icTagBase           base;           /* Signature, "desc" */
        icTextDescription   desc;           /* The description */
    } icTextDescriptionType;
     
    /* s15Fixed16Type */
    typedef struct {
        icTagBase           base;           /* Signature, "sf32" */
        icS15Fixed16Array   data;           /* Array of values */
    } icS15Fixed16ArrayType;
     
    typedef struct {
        icTagBase           base;           /* Signature, "scrn" */
        icScreening         screen;         /* Screening structure */
    } icScreeningType;
     
    /* sigType */
    typedef struct {
        icTagBase           base;           /* Signature, "sig" */
        icSignature         signature;      /* The signature data */
    } icSignatureType;
     
    /* textType */
    typedef struct {
        icTagBase           base;           /* Signature, "text" */
        icText              data;           /* Variable array of characters */
    } icTextType;
     
    /* u16Fixed16Type */
    typedef struct {
        icTagBase           base;           /* Signature, "uf32" */
        icU16Fixed16Array   data;           /* Variable array of values */
    } icU16Fixed16ArrayType;
     
    /* Under color removal, black generation type */
    typedef struct {
        icTagBase           base;           /* Signature, "bfd " */
        icUcrBg             data;           /* ucrBg structure */
    } icUcrBgType;
     
    /* uInt16Type */
    typedef struct {
        icTagBase           base;           /* Signature, "ui16" */
        icUInt16Array       data;           /* Variable array of values */
    } icUInt16ArrayType;
     
    /* uInt32Type */
    typedef struct {
        icTagBase           base;           /* Signature, "ui32" */
        icUInt32Array       data;           /* Variable array of values */
    } icUInt32ArrayType;
     
    /* uInt64Type */
    typedef struct {
        icTagBase           base;           /* Signature, "ui64" */
        icUInt64Array       data;           /* Variable array of values */
    } icUInt64ArrayType;
     
    /* uInt8Type */
    typedef struct {
        icTagBase           base;           /* Signature, "ui08" */
        icUInt8Array        data;           /* Variable array of values */
    } icUInt8ArrayType;
     
    /* viewingConditionsType */
    typedef struct {
        icTagBase           base;           /* Signature, "view" */
        icViewingCondition  view;           /* Viewing conditions */
    } icViewingConditionType;
     
    /* XYZ Type */
    typedef struct {
        icTagBase           base;           /* Signature, "XYZ" */
        icXYZArray          data;           /* Variable array of XYZ numbers */
    } icXYZType;
     
    /* CRDInfoType where [0] is the CRD product name count and string and
     * [1] -[5] are the rendering intents 0-4 counts and strings
     */
    typedef struct {
        icTagBase           base;           /* Signature, "crdi" */
        icCrdInfo           info;           /* 5 sets of counts & strings */
    }icCrdInfoType;
         /*   icCrdInfo       productName;     PS product count/string */
         /*   icCrdInfo       CRDName0;        CRD name for intent 0 */ 
         /*   icCrdInfo       CRDName1;        CRD name for intent 1 */ 
         /*   icCrdInfo       CRDName2;        CRD name for intent 2 */ 
         /*   icCrdInfo       CRDName3;        CRD name for intent 3 */
     
    /* ColorantOrderType type */
    typedef struct {
        icTagBase           base;           /* Signature, "clro" */
        icColorantOrder     order;          /* ColorantOrder     */
    }icColorantOrderType;
     
    /* ColorantTableType type */
    typedef struct {
        icTagBase           base;           /* Signature, "clrt" */
        icColorantTable     table;          /* ColorantTable     */
    }icColorantTableType;
     
    /* ChromaticAdaptation type */
    typedef struct {
        icTagBase           base;           /* Signature, "chad"            */
        icS15Fixed16Number  matrix[9];      /* ChromaticAdaptation Matrix   */
    }icChromaticAdaptationType;
     
    /*------------------------------------------------------------------------*/
     
    /*
     * Lists of tags, tags, profile header and profile strcuture
     */
     
    /* A tag */
    typedef struct {
        icTagSignature      sig;            /* The tag signature */
        icUInt32Number      offset;         /* Start of tag relative to 
                                             * start of header, Spec
                                             * Clause 5 */
        icUInt32Number      size;           /* Size in bytes */
    } icTag;
     
    /* A Structure that may be used independently for a list of tags */
    typedef struct {
        icUInt32Number      count;          /* Number of tags in the profile */
        icTag               tags[icAny];    /* Variable array of tags */
    } icTagList;
     
    /* The Profile header */
    typedef struct {
        icUInt32Number              size;           /* Profile size in bytes */
        icSignature                 cmmId;          /* CMM for this profile */
        icUInt32Number              version;        /* Format version number */
        icProfileClassSignature     deviceClass;    /* Type of profile */
        icColorSpaceSignature       colorSpace;     /* Color space of data */
        icColorSpaceSignature       pcs;            /* PCS, XYZ or Lab only */
        icDateTimeNumber            date;           /* Date profile was created */
        icSignature                 magic;          /* icMagicNumber */
        icPlatformSignature         platform;       /* Primary Platform */
        icUInt32Number              flags;          /* Various bit settings */
        icSignature                 manufacturer;   /* Device manufacturer */
        icUInt32Number              model;          /* Device model number */
        icUInt64Number              attributes;     /* Device attributes */
        icUInt32Number              renderingIntent;/* Rendering intent */
        icXYZNumber                 illuminant;     /* Profile illuminant */
        icSignature                 creator;        /* Profile creator */
        icInt8Number                reserved[44];   /* Reserved for future use */
    } icHeader;
     
    /* 
     * A profile, 
     * we can't use icTagList here because its not at the end of the structure
     */
    typedef struct {
        icHeader            header;         /* The header */
        icTagList           tagList;        /* with tagList */
        /* Original:
        icHeader            header;             The header 
        icUInt32Number      count;              Number of tags in the profile 
        icInt8Number        data[icAny];        The tagTable and tagData */
    /*
     * Data that follows is of the form
     *
     * icTag        tagTable[icAny];        * The tag table 
     * icInt8Number tagData[icAny];         * The tag data 
     */
    } icProfile;               
     
    /*------------------------------------------------------------------------*/
    /* Obsolete entries */
     
    /* icNamedColor was replaced with icNamedColor2 *
    typedef struct {
        icUInt32Number      vendorFlag;     / Bottom 16 bits for IC use *
        icUInt32Number      count;          / Count of named colors *
        icInt8Number        data[icAny];    / Named color data follows *
     *
     *  Data that follows is of this form
     *
     * icInt8Number         prefix[icAny];      * Prefix for the color name, max = 32
     * icInt8Number         suffix[icAny];      * Suffix for the color name, max = 32
     * icInt8Number         root1[icAny];       * Root name for first color, max = 32
     * icInt8Number         coords1[icAny];     * Color coordinates of first color
     * icInt8Number         root2[icAny];       * Root name for first color, max = 32
     * icInt8Number         coords2[icAny];     * Color coordinates of first color
     *                      :
     *                      :
     * Repeat for root name and color coordinates up to (count-1)
     *
    } icNamedColor; */
     
    /* icNamedColorType was replaced by icNamedColor2Type *
    typedef struct {
        icTagBase           base;           / Signature, "ncol" *
        icNamedColor        ncolor;         / Named color data *
    } icNamedColorType; */
     
    #endif /* ICC_H */
     
    ISO12642-2
    ORIGINATOR "Fogra, www.fogra.org"
    DESCRIPTOR "FOGRA44L"
    CREATED    "June 2008"
    INSTRUMENTATION "D50, 2 degree, geometry 45/0, no polarisation filter, white backing, according to ISO 13655"
    PRINT_CONDITIONS "Offset printing, according to ISO 12647-2:2004/Amd1, OFCOM, paper type 4 = uncoated white, 115 g/m2, non-periodic screening, tone value increase curves F (CMYK)"
    NUMBER_OF_FIELDS 11
    BEGIN_DATA_FORMAT
    SAMPLE_ID CMYK_C CMYK_M CMYK_Y CMYK_K XYZ_X XYZ_Y XYZ_Z LAB_L LAB_A LAB_B
    END_DATA_FORMAT
    NUMBER_OF_SETS 1617
    BEGIN_DATA
    1        0     0     0     0   84.48   87.62   74.57   95.00    0.00   -2.00
    2        0    10     0     0   76.57   74.01   65.41   88.93   10.75   -4.19
    3        0    20     0     0   69.36   62.47   57.28   83.16   20.58   -6.12
    4        0    30     0     0   63.16   53.17   50.04   77.98   29.16   -7.26
    5        0    40     0     0   57.60   45.48   43.74   73.21   36.58   -8.06
    6        0    55     0     0   51.02   36.87   35.77   67.18   45.87   -7.95
    7        0    70     0     0   46.06   31.00   29.40   62.51   52.46   -6.43
    8        0    85     0     0   42.27   26.81   24.16   58.80   57.40   -3.82
    9        0   100     0     0   39.50   23.91   20.21   56.00   61.00   -1.00
    10      10     0     0     0   71.46   76.84   72.90   90.25   -5.47   -8.72
    11      10    10     0     0   64.12   64.54   63.44   84.24    4.33  -10.38
    12      10    20     0     0   58.18   54.66   55.67   78.84   13.72  -11.88
    13      10    30     0     0   53.18   46.86   48.92   74.10   21.68  -12.66
    14      10    40     0     0   48.62   40.24   42.86   69.64   28.83  -13.12
    15      10    55     0     0   43.06   32.75   35.25   63.95   37.54  -12.77
    16      10    70     0     0   38.88   27.58   29.16   59.50   43.95  -11.22
    17      10    85     0     0   35.56   23.78   24.10   55.87   48.75   -8.78
    18      10   100     0     0   33.08   21.10   20.22   53.05   52.40   -6.10
    19      20     0     0     0   60.43   67.38   71.00   85.69  -10.45  -14.89
    20      20    10     0     0   54.28   56.78   61.96   80.06   -1.20  -16.16
     
    ...
     
    1610    70    70    70    10   12.28   12.59   11.32   42.14    0.96   -2.91
    1611    50    40    40     0   22.80   24.00   22.35   56.09   -1.58   -5.11
    1612   100     0     0    10   18.60   24.42   44.29   56.50  -23.58  -37.53
    1613     0   100     0    10   32.72   20.72   18.02   52.64   52.92   -2.09
    1614     0     0   100    10   54.44   58.04   10.68   80.76   -3.84   65.68
    1615     0   100   100    10   28.38   18.64    8.09   50.27   46.95   22.04
    1616   100     0   100    10   12.16   19.29   11.36   51.02  -38.13   12.31
    1617   100   100     0    10   10.18    9.59   17.29   37.10    7.45  -27.24
    END_DATA
    Manifestement, je n'ai pas compris quel est le format attendu (peut-être ne faut-il que l'une des deux parties? J'ai essayé mais sans succès encore une fois... ou alors il manque des bouts?) ou alors la syntaxe du code java est erronée.
    L'erreur renvoyée est:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Invalid ICC Profile Data
    	at java.awt.color.ICC_Profile.getInstance(ICC_Profile.java:973)
    	at java.awt.color.ICC_Profile.getInstance(ICC_Profile.java:941)
    	at interfacecarto.couleurs.Couleur_xml.<init>(Couleur_xml.java:281) ...
    Si vous avez une solution ou un bon tuto sur le sujet, ce serait super!
    Merci d'avance pour votre aide!

  7. #27
    Rédacteur
    Avatar de pseudocode
    Homme Profil pro
    Architecte système
    Inscrit en
    Décembre 2006
    Messages
    10 062
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Architecte système
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2006
    Messages : 10 062
    Points : 16 081
    Points
    16 081
    Par défaut
    Le constructeur de ICC_Profile n'accepte que des données au format ICC.1:2001 (= format binaire, pas texte).
    ALGORITHME (n.m.): Méthode complexe de résolution d'un problème simple.

  8. #28
    Futur Membre du Club
    Profil pro
    Inscrit en
    Juin 2009
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2009
    Messages : 4
    Points : 5
    Points
    5
    Par défaut
    Merci pour cette réponse rapide!

    Ou pourrais-je trouver ce genre de fichier?
    Aurais-tu une adresse ou un bout d'exemple que je pourrais adapter, stp ?


    Et si quelqu'un connais des bons tutos ou doc sur ce sujet, je suis toujours preneuse...!



    D'avance merci, et bonne journée!

  9. #29
    Rédacteur
    Avatar de pseudocode
    Homme Profil pro
    Architecte système
    Inscrit en
    Décembre 2006
    Messages
    10 062
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Architecte système
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2006
    Messages : 10 062
    Points : 16 081
    Points
    16 081
    Par défaut
    Ton problème est vraiment celui là ?

    Voilà, je voudrais créer une couleur (instance de la classe Color de java) à partir de coordonnées du système CIELab
    Ou alors tu cherches à obtenir une couleur donnée contenue dans ton fichier IT8 (texte) ?
    ALGORITHME (n.m.): Méthode complexe de résolution d'un problème simple.

  10. #30
    Futur Membre du Club
    Profil pro
    Inscrit en
    Juin 2009
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2009
    Messages : 4
    Points : 5
    Points
    5
    Par défaut
    Citation Envoyé par pseudocode Voir le message
    Ton problème est vraiment celui là ?
    Oui, oui mon problème est vraiment celui-là.
    Je m'y prends peut-être pas par le bon bout, c'est tout.
    ça fait quand même un bon moment que je cherche et je n'arrive pas non plus à trouver de bons exemples ou conseils à ce sujet.

    J'ai réussit à créer une couleur (toujours une instance de la classe Color java) à partir de coordonnées xyz en faisant comme ça:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    float[] xyz = new float[3];
    ...
    Color c = new Color(ColorSpace.getInstance(ColorSpace.CS_CIEXYZ),xyz,1f);
    J'aimerais faire quelque chose de similaire à partir de coordonnées CIELab.
    Mais si je fais:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    float[] lab = new float[3];
    ...
    Color c = new Color(ColorSpace.getInstance(ColorSpace.TYPE_Lab),lab,1f);
    ça ne marche pas parce que ce ColorSpace n'est pas définit.

    J'ai bien vu dans tes réponses que l'on peut créer un ColorSpace.
    Je pense pouvoir y arriver, je suis aussi en train d'essayer en parallèle.

    Mais ce qui me gène, c'est que la conversion "aller-retour" (RVG->CIELab->RVB) ne serait pas totalement exacte il me semble.
    Donc, j'ai pensé que je pourrais utiliser un système standardisé, et c'est là que je me suis orientée vers les profils ICC.

    Ce n'est peut-être pas la bonne méthode. Mais, je ne trouve pas beaucoup d'aide à ce sujet (je sais je me répète) donc, j'explore un peu toutes les pistes à tâtons...
    Pourtant, je suis sûre que pleins de gens se sont déjà posé les mêmes questions!


    Merci d'avance pour vos conseils!

  11. #31
    Rédacteur
    Avatar de pseudocode
    Homme Profil pro
    Architecte système
    Inscrit en
    Décembre 2006
    Messages
    10 062
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Architecte système
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2006
    Messages : 10 062
    Points : 16 081
    Points
    16 081
    Par défaut
    Le plus simple c'est de calculer la couleur en passant par les formules de conversion LAB->XYZ, puis XYZ->sRGB.

    Les formules sont dispo sur easyrgb.

    Exemple:
    Code java : 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
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    /**
     * Create a Color instance from given CIELab value 
     * 
     * @param L in range [0,1]
     * @param a in range [0,1]
     * @param b in range [0,1]
     * @return Color instance
     */
    static Color ColorFromLAB(float L, float a, float b) {
    	// Lab constant
    	float d = 6f/29, d2 = d*d;
     
    	// Lab [0..1] --> stimulus
    	float fy = (L+0.16f)/1.16f;
    	float fx = fy + (a-0.5f)*0.4f;
    	float fz = fy - (b-0.5f);
     
    	float Y = (fy>d) ? fy*fy*fy : (fy-16f/116)*3*d2;
    	float X = (fx>d) ? fx*fx*fx : (fx-16f/116)*3*d2;
    	float Z = (fz>d) ? fz*fz*fz : (fz-16f/116)*3*d2;
     
    	// D65 reference white
    	X *= 0.95047f;
    	Y *= 1.0f;
    	Z *= 1.08883f;
     
    	// Convert to linear RGB (D65)
    	float R = X *  3.2406f + Y * -1.5372f + Z * -0.4986f;
    	float G = X * -0.9689f + Y *  1.8758f + Z *  0.0415f;
    	float B = X *  0.0557f + Y * -0.2040f + Z *  1.0570f;
     
    	// Convert to sRGB (D65)
    	if ( R <= 0.0031308f ) R*=12.92f; else R = 1.055f * (float)Math.pow(R,1f/2.4) - 0.055f;
    	if ( G <= 0.0031308f ) G*=12.92f; else G = 1.055f * (float)Math.pow(G,1f/2.4) - 0.055f;
    	if ( B <= 0.0031308f ) B*=12.92f; else B = 1.055f * (float)Math.pow(B,1f/2.4) - 0.055f;
     
    	// RGB range limiter
    	R = Math.max(0, Math.min(1, R));
    	G = Math.max(0, Math.min(1, G));
    	B = Math.max(0, Math.min(1, B));
     
    	return new Color(R,G,B);
    }


    Petite animation montrant les couleurs LAB pour différentes valeurs de L.

    ALGORITHME (n.m.): Méthode complexe de résolution d'un problème simple.

  12. #32
    Modérateur
    Avatar de ToTo13
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Janvier 2006
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Chercheur en informatique
    Secteur : Santé

    Informations forums :
    Inscription : Janvier 2006
    Messages : 5 793
    Points : 9 860
    Points
    9 860
    Par défaut
    Bonsoir,

    je relance cette discussion, car j'ai encore des besoins dans le domaine.

    Je souhaite cette fois-ci créer une BufferedImage avec un DataBuffer de type Double ou Float, mais comportant de 1 à 3 canaux.

    Si j'utilise la version décrite précédemment :
    Code java : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    public static BufferedImage YIQ(int width, int height)
    	{
    	ColorSpace myColorSpace = new YIQ() ;
     
    	ColorModel myColorModel = new ComponentColorModel(myColorSpace,null,false,false,ColorModel.OPAQUE,DataBuffer.TYPE_FLOAT) ;
     
    	return new BufferedImage(myColorModel, myColorModel.createCompatibleWritableRaster(width, height), false, null) ;
    	}
    j'aurai à ce moment là deux soucis :
    - 1 - si je fais une image double, avec cette méthode je dois créer mon propre ColorSpace qui lui ne gère QUE des float => toutes mes valeurs lors du passage vers le ColorSpace seront donc transformée de Double en Float.
    - 2 - Je n'ai gère qu'un seul canal, or je souhaiterai en gérer N.

    Est ce que quelqu'un saurait comment faire svp ?
    Merci par avance.
    Consignes aux jeunes padawans : une image vaut 1000 mots !
    - Dans ton message respecter tu dois : les règles de rédaction et du forum, prévisualiser, relire et corriger TOUTES les FAUTES (frappes, sms, d'aurteaugrafe, mettre les ACCENTS et les BALISES) => ECRIRE clairement et en Français tu DOIS.
    - Le côté obscur je sens dans le MP => Tous tes MPs je détruirai et la réponse tu n'auras si en privé tu veux que je t'enseigne.(Lis donc ceci)
    - ton poste tu dois marquer quand la bonne réponse tu as obtenu.

  13. #33
    Modérateur
    Avatar de ToTo13
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Janvier 2006
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Chercheur en informatique
    Secteur : Santé

    Informations forums :
    Inscription : Janvier 2006
    Messages : 5 793
    Points : 9 860
    Points
    9 860
    Par défaut
    Petite rectification : il semblerait qu'il y ait en fait trois canaux par défaut et non 1.
    Consignes aux jeunes padawans : une image vaut 1000 mots !
    - Dans ton message respecter tu dois : les règles de rédaction et du forum, prévisualiser, relire et corriger TOUTES les FAUTES (frappes, sms, d'aurteaugrafe, mettre les ACCENTS et les BALISES) => ECRIRE clairement et en Français tu DOIS.
    - Le côté obscur je sens dans le MP => Tous tes MPs je détruirai et la réponse tu n'auras si en privé tu veux que je t'enseigne.(Lis donc ceci)
    - ton poste tu dois marquer quand la bonne réponse tu as obtenu.

  14. #34
    Rédacteur
    Avatar de pseudocode
    Homme Profil pro
    Architecte système
    Inscrit en
    Décembre 2006
    Messages
    10 062
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Architecte système
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2006
    Messages : 10 062
    Points : 16 081
    Points
    16 081
    Par défaut
    Citation Envoyé par ToTo13 Voir le message
    j'aurai à ce moment là deux soucis :
    - 1 - si je fais une image double, avec cette méthode je dois créer mon propre ColorSpace qui lui ne gère QUE des float => toutes mes valeurs lors du passage vers le ColorSpace seront donc transformée de Double en Float.
    Effectivement, ColorSpace ne gère QUE des floats.

    - 2 - Je n'ai gère qu'un seul canal, or je souhaiterai en gérer N.

    Petite rectification : il semblerait qu'il y ait en fait trois canaux par défaut et non 1.
    Il y a autant de canaux que défini dans ton instance de ColorSpace, via le constructeur ColorSpace(int type, int numcomponents).
    ALGORITHME (n.m.): Méthode complexe de résolution d'un problème simple.

  15. #35
    Modérateur
    Avatar de ToTo13
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Janvier 2006
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Chercheur en informatique
    Secteur : Santé

    Informations forums :
    Inscription : Janvier 2006
    Messages : 5 793
    Points : 9 860
    Points
    9 860
    Par défaut
    Citation Envoyé par pseudocode Voir le message
    Effectivement, ColorSpace ne gère QUE des floats.[/COLOR])[/B].
    Donc si je souhaite créer une image Double, je ne pourrais jamais passer par le ColorSpace sans perdre en information et donc je devrai uniquement travailler par le DataBuffer.
    Est ce bien cela ?


    Citation Envoyé par pseudocode Voir le message
    Il y a autant de canaux que défini dans ton instance de ColorSpace, via le constructeur ColorSpace(int type, int numcomponents).
    Oups... j'ai mal lu la JavaDoc. Mea Culpa
    Consignes aux jeunes padawans : une image vaut 1000 mots !
    - Dans ton message respecter tu dois : les règles de rédaction et du forum, prévisualiser, relire et corriger TOUTES les FAUTES (frappes, sms, d'aurteaugrafe, mettre les ACCENTS et les BALISES) => ECRIRE clairement et en Français tu DOIS.
    - Le côté obscur je sens dans le MP => Tous tes MPs je détruirai et la réponse tu n'auras si en privé tu veux que je t'enseigne.(Lis donc ceci)
    - ton poste tu dois marquer quand la bonne réponse tu as obtenu.

  16. #36
    Rédacteur
    Avatar de pseudocode
    Homme Profil pro
    Architecte système
    Inscrit en
    Décembre 2006
    Messages
    10 062
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Architecte système
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2006
    Messages : 10 062
    Points : 16 081
    Points
    16 081
    Par défaut
    Citation Envoyé par ToTo13 Voir le message
    Donc si je souhaite créer une image Double, je ne pourrais jamais passer par le ColorSpace sans perdre en information et donc je devrai uniquement travailler par le DataBuffer.
    Est ce bien cela ?
    ColorSpace est une classe abstraite. Il faut forcément la spécialiser en une classe concrète.

    C'est vrai qu'il faut implémenter to/from CIEXYZ/RGB qui utilisent des floats, mais tu peux y ajouter tes propres méthodes to/from qui gèrent des doubles.

    Bien sur, les opérateurs standards ne gèreront pas ces nouvelles méthodes et donc tu devras créer des opérateurs spécifiques.
    ALGORITHME (n.m.): Méthode complexe de résolution d'un problème simple.

  17. #37
    Modérateur
    Avatar de ToTo13
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Janvier 2006
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Chercheur en informatique
    Secteur : Santé

    Informations forums :
    Inscription : Janvier 2006
    Messages : 5 793
    Points : 9 860
    Points
    9 860
    Par défaut
    mmm... comme j'ai l'habitude de travaille directement dans le DataBuffer, je pense que je vais créer un ColorSpace neutre en float qui en fait ne sera jamais utilisé.

    Merci.
    Consignes aux jeunes padawans : une image vaut 1000 mots !
    - Dans ton message respecter tu dois : les règles de rédaction et du forum, prévisualiser, relire et corriger TOUTES les FAUTES (frappes, sms, d'aurteaugrafe, mettre les ACCENTS et les BALISES) => ECRIRE clairement et en Français tu DOIS.
    - Le côté obscur je sens dans le MP => Tous tes MPs je détruirai et la réponse tu n'auras si en privé tu veux que je t'enseigne.(Lis donc ceci)
    - ton poste tu dois marquer quand la bonne réponse tu as obtenu.

  18. #38
    Rédacteur
    Avatar de pseudocode
    Homme Profil pro
    Architecte système
    Inscrit en
    Décembre 2006
    Messages
    10 062
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Architecte système
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2006
    Messages : 10 062
    Points : 16 081
    Points
    16 081
    Par défaut
    Citation Envoyé par ToTo13 Voir le message
    mmm... comme j'ai l'habitude de travaille directement dans le DataBuffer, je pense que je vais créer un ColorSpace neutre en float qui en fait ne sera jamais utilisé.
    Le ColorSpace c'est tout de même pratique pour afficher/sauvegarder correctement une BufferedImage, ne serait-ce que pour débuguer.
    ALGORITHME (n.m.): Méthode complexe de résolution d'un problème simple.

  19. #39
    Modérateur
    Avatar de ToTo13
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Janvier 2006
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Chercheur en informatique
    Secteur : Santé

    Informations forums :
    Inscription : Janvier 2006
    Messages : 5 793
    Points : 9 860
    Points
    9 860
    Par défaut
    Citation Envoyé par pseudocode Voir le message
    Le ColorSpace c'est tout de même pratique pour afficher/sauvegarder correctement une BufferedImage, ne serait-ce que pour débuguer.
    Ben justement, me voilà embêté par les I/O.
    J'ai créé des images avec des DataBufferInt (resp. DataBufferDouble) :
    Code java : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    ColorSpace myColorSpace = new FloatCS(channel == 1 ? ColorSpace.TYPE_GRAY : ColorSpace.TYPE_RGB, channel) ;
     
    ColorModel myColorModel = new ComponentColorModel(myColorSpace,null,false,false,ColorModel.OPAQUE,DataBuffer.TYPE_INT) ;
     
    return new BufferedImage(myColorModel, myColorModel.createCompatibleWritableRaster(width, height), false, null) ;

    Seulement voilà, maintenant j'aimerai lire/écrire de telles images. JAI ne veut pas en entendre parler et ImageIO m'écrit une image vide.

    Une idée ?
    Consignes aux jeunes padawans : une image vaut 1000 mots !
    - Dans ton message respecter tu dois : les règles de rédaction et du forum, prévisualiser, relire et corriger TOUTES les FAUTES (frappes, sms, d'aurteaugrafe, mettre les ACCENTS et les BALISES) => ECRIRE clairement et en Français tu DOIS.
    - Le côté obscur je sens dans le MP => Tous tes MPs je détruirai et la réponse tu n'auras si en privé tu veux que je t'enseigne.(Lis donc ceci)
    - ton poste tu dois marquer quand la bonne réponse tu as obtenu.

  20. #40
    Modérateur
    Avatar de ToTo13
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Janvier 2006
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Chercheur en informatique
    Secteur : Santé

    Informations forums :
    Inscription : Janvier 2006
    Messages : 5 793
    Points : 9 860
    Points
    9 860
    Par défaut
    J'ai oublié de préciser que FloatCS est un ColorSpace neutre :
    Code java : 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
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
     
    public class FloatCS extends ColorSpace
    {
    private static final long serialVersionUID = -7713114653902159981L;
     
    private ColorSpace rgb = ColorSpace.getInstance(ColorSpace.CS_sRGB) ;
     
    public FloatCS(int type, int channel)
    	{
    	super(type, channel) ;
    	}
     
    public float[] fromCIEXYZ(float[] pixel)
    	{
    	return fromRGB(rgb.fromCIEXYZ(pixel)) ;
    	}
     
    public float[] fromRGB(float[] RGB)
    	{	
    	return RGB ;
    	}
     
    public float[] toCIEXYZ(float[] pixel)
    	{
    	return rgb.toCIEXYZ(toRGB(pixel)) ;
    	}
     
    public float[] toRGB(float[] nRGB)
    	{
    	return nRGB ;
    	}
    }
    Consignes aux jeunes padawans : une image vaut 1000 mots !
    - Dans ton message respecter tu dois : les règles de rédaction et du forum, prévisualiser, relire et corriger TOUTES les FAUTES (frappes, sms, d'aurteaugrafe, mettre les ACCENTS et les BALISES) => ECRIRE clairement et en Français tu DOIS.
    - Le côté obscur je sens dans le MP => Tous tes MPs je détruirai et la réponse tu n'auras si en privé tu veux que je t'enseigne.(Lis donc ceci)
    - ton poste tu dois marquer quand la bonne réponse tu as obtenu.

+ Répondre à la discussion
Cette discussion est résolue.
Page 2 sur 3 PremièrePremière 123 DernièreDernière

Discussions similaires

  1. [Débutant] Dessiner les espaces de couleurs RGB et HSV
    Par marko1587 dans le forum MATLAB
    Réponses: 9
    Dernier message: 04/04/2014, 19h15
  2. Réponses: 9
    Dernier message: 06/11/2007, 12h36
  3. [String] comment virer tous les espaces vides ?
    Par Alec6 dans le forum Langage
    Réponses: 6
    Dernier message: 26/07/2004, 14h27
  4. Enlever les espaces
    Par Claythest dans le forum Langage
    Réponses: 6
    Dernier message: 03/06/2003, 14h43
  5. Comment gérer les espaces blancs?
    Par Lambo dans le forum XML/XSL et SOAP
    Réponses: 10
    Dernier message: 16/05/2003, 09h44

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo