Expand grayscale JPEGs to RGB(A)

And handle grayscale jpeg example file in test suite.
This commit is contained in:
Jeroen van Rijn
2025-09-09 17:13:21 +02:00
parent 7b3ca701e0
commit 572b26a846
4 changed files with 35 additions and 10 deletions
+2
View File
@@ -2,4 +2,6 @@
*.zip
*.png
*.jpg
*.qoi
*.pbm
math_big_test_library.*
+1
View File
@@ -282,6 +282,7 @@ HMAC_DIGESTS = {
'emblem-1024.jpg': "d7b7e3ffaa5cda04c667e3742752091d78e02aa2d3c7a63406af679ce810a0a86666b10fcab12cc7ead2fadf2f6c2e1237bc94f892a62a4c218e18a20f96dbe4",
'emblem-1024-progressive.jpg': "7a6f4b112bd7189320c58dcddb9129968bcf268798c1e0c4f2243c10b3e3d9a6962c9f142d9fd65f8fb31e9a1e899008cae22b3ffde713250d315499b412e160",
'emblem-1024-gray.jpg': "4c25aaab92451e0452cdb165833b2b5a51978c2571de9d053950944667847666ba198d3001291615acda098ebe45b7d2d53c210c492f077b04a6bfe386f8a5fd",
'unicode.xml': "e0cdc94f07fdbb15eea811ed2ae6dcf494a83d197dafe6580c740270feb0d8f5f7146d4a7d4c2d2ea25f8bd9678bc986123484b39399819a6b7262687959d1ae",
}
+8
View File
@@ -51,6 +51,7 @@ Blend_BG_Keep :: image.Options{.blend_background, .alpha_add_if_missing}
Return_Metadata :: image.Options{.return_metadata}
No_Channel_Expansion :: image.Options{.do_not_expand_channels, .return_metadata}
Dims :: struct {
width: int,
height: int,
@@ -2375,6 +2376,13 @@ Basic_JPG_Tests := []Test{
{Default, .Unsupported_Frame_Type, {1024, 1024, 3, 8}, 0x_46a29e0f},
},
},
{
"emblem-1024-gray", {
{Default, nil, {1024, 1024, 3, 8}, 0x_4115d669},
{Alpha_Add, nil, {1024, 1024, 4, 8}, 0x_db496297},
{No_Channel_Expansion, .Unsupported_Option, {1024, 1024, 1, 8}, 0},
},
},
}
@test