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

Đang mở
#4,286 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
cpp
Lĩnh vực
computer-graphics

Hướng nghiên cứu

Kiểm tra src/tiff.imageio/tiffoutput.cpp quanh dòng 721–722 và theo dõi cách ImageSpec.format và TIFFTAG_BITSPERSAMPLE được thiết lập cho đầu ra CMYK. Tái hiện bằng một ImageSpec UINT16 với tiff:ColorSpace được đặt thành CMYK, sau đó xác minh bằng exiftool, Mac Preview hoặc Photoshop rằng đầu ra vẫn là 16-bit.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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)) {
Ngôn ngữ chính
C++
Star
2.4k
Fork
727
Merge trung bình
4 ngày 8 giờ
Pull request đã merge (30 ngày)
67

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của AcademySoftwareFoundation/OpenImageIO

Tất cả issue của AcademySoftwareFoundation/OpenImageIO

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.