LibGfx/JPEG: Accept grayscale images with an App14 segment

The adobe specification doesn't even consider JPEG images with a single
component. So let's not consider the content of the App14 segment for
grayscale images.
This commit is contained in:
Lucas CHOLLET 2023-06-23 00:15:49 -04:00 committed by Sam Atkins
parent 8df714ff1e
commit af14ed6b2e
Notes: sideshowbarker 2024-07-16 23:05:02 +09:00

View file

@ -1687,7 +1687,9 @@ static void ycck_to_rgb(JPEGLoadingContext const& context, Vector<Macroblock>& m
static ErrorOr<void> handle_color_transform(JPEGLoadingContext const& context, Vector<Macroblock>& macroblocks)
{
if (context.color_transform.has_value()) {
// Note: This is non-standard but some encoder still add the App14 segment for grayscale images.
// So let's ignore the color transform value if we only have one component.
if (context.color_transform.has_value() && context.components.size() != 1) {
// https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-T.872-201206-I!!PDF-E&type=items
// 6.5.3 - APP14 marker segment for colour encoding