16-bit CIELAB (LabS) TIFF with associated alpha: alpha is clipped to 8 bits on load
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 42/100
Hướng nghiên cứu
Start in libvips/iofuncs or libvips/iofuncs/... where vips_interpretation_max_alpha() is defined and look at its switch over interpretations, which has explicit GREY16 and RGB16 cases and a default of 255. Reproduce with the attached labs16_alpha.tif via vips copy labs16_alpha.tif out.tif and compare the alpha column. Done means LabS 16-bit alpha uses the signed-short maximum of 32767 and the colour bands are preserved, verified by a test that checks the first row values in the table.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug report
Description
Loading a 16-bit CIELAB TIFF that carries an associated (premultiplied) alpha band destroys the alpha channel. Every alpha sample above 255 is clipped to 255.
Reproducible example
labs16_alpha.tif is a 16x16, 4-band, 16-bit TIFF: photometric CIELAB,
EXTRASAMPLE_ASSOCALPHA, seven distinct alpha values, 2.3 KB.
labs16_alpha.tif
$ vips copy labs16_alpha.tif out.tif
The first pixel row, before and after (bands are L, a, b, alpha):
| source | out (8.18.7) |
|---|---|
[32766, 16383, 16383, 32767] |
[254, 127, 127, 255] |
[4680, 2340, 2340, 4681] |
[254, 127, 127, 255] |
[1056, 528, 528, 1057] |
[254, 127, 127, 255] |
[216, 108, 108, 217] |
[252, 126, 126, 217] |
[150, 75, 75, 151] |
[252, 126, 126, 151] |
[30, 15, 15, 31] |
[246, 123, 123, 31] |
[6, 3, 3, 7] |
[218, 109, 109, 7] |
Expected result
vips copy keeps all of the alpha data and the full 16-bit range of the colour bands
Actual result
The alpha column is exactly clip(src, 0, 255), so 32767, 4681 and 1057 all collapse to 255. Other values miscalculated accordingly.
Environment
- OS: Windows 11 Pro
- libvips version: 8.18.7, and also tested 9edee694f built with MSYS2 UCRT64
Severity / impact
- Crash / data loss.
- Incorrect result.
- Build / install problem.
- Performance / memory issue.
- Other (please specify).
Additional context
vips_interpretation_max_alpha() has explicit cases for GREY16 and RGB16
(65535) and for scRGB (1.0), and lets everything else fall through to a
default of 255. LABS is not listed, so 16-bit LabS alpha is treated as 8-bit
alpha.
Possible steps
- add the missing 16-bit interpretations to the switch, using the maximum of the
corresponding 16-bit range (for LabS that maximum is 32767, not 65535. LabS is stored as signed short) - Another option: whether the scale can be derived from the band format together with the interpretation instead of a hand-maintained list
Disclaimer
I did not encounter this issue in my real pipeline, it just popped up when researching #5280 It probably has low priority given the rarity of the image format
- Ngôn ngữ chính
- C
- Star
- 11.9k
- Fork
- 811
- Merge trung bình
- 1 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 44
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của libvips/libvips
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ICtCp colorspace supportĐang mởenhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
libvips/libvips#5297 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của libvips/libvips
Issue tương tự
-
Make the HTTP server's keep-alive and headers timeouts configurableCó thể đã có người làm @mattgodbolt đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
compiler-explorer/compiler-explorer#9902 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
timescale/pg_vectorsearch#446 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
signalwire/freeswitch#3329 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Status: Opened
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
espressif/esp-protocols#1224 ·
Maintainer thường phản hồi trong vòng 1 ngày