From 2f64596120fc9992768fca7813517de19df12b6b Mon Sep 17 00:00:00 2001 From: brendan-duncan Date: Mon, 13 Jan 2025 07:47:29 -0700 Subject: [PATCH] change the default background color to white instead of black --- lib/src/formats/jpeg_encoder.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/formats/jpeg_encoder.dart b/lib/src/formats/jpeg_encoder.dart index 502c7796..356d0142 100644 --- a/lib/src/formats/jpeg_encoder.dart +++ b/lib/src/formats/jpeg_encoder.dart @@ -123,7 +123,7 @@ class JpegEncoder extends Encoder { return fp.getBytes(); } - static const _black = const ConstColorRgb8(0, 0, 0); + static const _backgroundColor = const ConstColorRgb8(255, 255, 255); void _calculateYUV( Image image, @@ -157,7 +157,7 @@ class JpegEncoder extends Encoder { p = p.convert(format: Format.uint8); } if (p.length > 3) { - final backgroundColor = image.backgroundColor ?? _black; + final backgroundColor = image.backgroundColor ?? _backgroundColor; final a = p.aNormalized; final invA = 1.0 - a; p..r = (p.r * a + backgroundColor.r * invA).round()