[BUG] TIFFs saved with CMYK ColorSpace always get converted to 8-bit

Ouverte
#4,286 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 3 jours

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
45/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
À l'abandon
Stack technique
cpp

Piste de recherche

Inspectez src/tiff.imageio/tiffoutput.cpp autour des lignes 721–722 et suivez la manière dont ImageSpec.format et TIFFTAG_BITSPERSAMPLE sont définis pour la sortie CMYK. Reproduisez le problème avec un ImageSpec UINT16 et tiff:ColorSpace défini sur CMYK, puis vérifiez avec exiftool, Mac Preview ou Photoshop que la sortie reste en 16 bits.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Describe the bug

When trying to save 16-bit data into a TIFF with CMYK color space applied, it outputs as 8-bit instead.

OpenImageIO version and dependencies

2.4.11.0

To Reproduce

Steps to reproduce the behavior:

  1. Create an ImageSpec with UINT16 format, and tiff:ColorSpace set to "CMYK"
  2. Open ImageOutput with the spec
  3. Write 16-bit data to it
  4. Output file is 8-bit

Not sure how to reproduce this flow in oiiotool, but if someone can give me a command that does this I can try it out.

Evidence

Cannot attach specific images, but exiftool, Mac Preview, and Photoshop all confirm that the output is 8-bit.

IF YOU ALREADY HAVE A CODE FIX: There is no need to file a separate issue,
please just go straight to making a pull request.

I do not have a code fix specifically, but mainly opening this as a question on a portion of code I think is causing this. Specifically, this if statement will evaluate to true no matter what format is:

https://github.com/AcademySoftwareFoundation/OpenImageIO/blob/24f172a7e7581fa8c38bee2d01a7e8e4985b3d8b/src/tiff.imageio/tiffoutput.cpp#L721-L722

Because of this everything is getting converted to 8-bit. However, I'm not sure if it's trying to do this on purpose because there doesn't seem to be any handling for 16-bit values.

For reference, this is what my potential fix would be, but I am not in a position to test this properly right now and probably won't be soon which is why this is not a PR.

            m_photometric = PHOTOMETRIC_SEPARATED;

            if (m_spec.format == TypeDesc::UINT16) {
                m_bitspersample = 16;
            } else {
                // Make everything else UINT8
                m_spec.format   = TypeDesc::UINT8;
                m_bitspersample = 8;
            }

            TIFFSetField(m_tif, TIFFTAG_BITSPERSAMPLE, m_bitspersample);
            TIFFSetField(m_tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);

            if (source_is_rgb(m_spec)) {
Langage dominant
C++
Étoiles
2.4k
Forks
727
Merge moyen
4 j 8 h
PR mergées (30 j)
67

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de AcademySoftwareFoundation/OpenImageIO

Toutes les issues de AcademySoftwareFoundation/OpenImageIO

Issues similaires

Plus d'issues C++

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.