imgA: jpeg opts.native (grey files -> gray8); Dct local type annotations

This commit is contained in:
4DBug committed 2026-10-31 08:44:49 -05:00
1 parent d741722b52
commit 11ad899fa3
3 files changed
+16 -1

No files matched your search

+7
View File
@@ -80,6 +80,13 @@ do
t:check(i.colorSpace == "ycbcr" and i.precision == 8 and i.jfif and not i.arithmetic, "info: colour space")
t:check(Jpeg.info(Bytes.reader(file("photo_arith_420_prog"))).arithmetic, "info: arithmetic")
t:eq(Jpeg.info(Bytes.reader(file("photo_gray"))).colorSpace, "gray", "info: grey")
do
local g = decode(file("photo_gray"), { native = true })
local rgba = decode(file("photo_gray"))
t:check(g.format == "gray8" and buffer.len(g.pixels) == g.width * g.height, "native grey decodes to gray8")
t:eq(buffer.readu8(g.pixels, 77), buffer.readu8(rgba.pixels, 77 * 4), "gray8 samples")
t:eq(decode(file("photo_q90_420"), { native = true }).format, "rgba8", "native colour stays rgba8")
end
t:eq(Jpeg.info(Bytes.reader(file("photo_rgb"))).colorSpace, "rgb", "info: RGB")
t:eq(Jpeg.info(Bytes.reader(file("photo_cmyk"))).colorSpace, "cmyk", "info: CMYK")
t:eq(Jpeg.info(Bytes.reader(file("photo_ycck"))).colorSpace, "ycck", "info: YCCK")