Skip to content

Commit

Permalink
change the default background color to white instead of black
Browse files Browse the repository at this point in the history
  • Loading branch information
brendan-duncan committed Jan 13, 2025
1 parent 2065af4 commit 2f64596
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/src/formats/jpeg_encoder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 2f64596

Please sign in to comment.