Black alpha before color type reductions
This commit is contained in:
parent
43d0ee8807
commit
716b5bf135
2 changed files with 8 additions and 1 deletions
|
|
@ -726,6 +726,13 @@ fn perform_reductions(
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.color_type_reduction {
|
if opts.color_type_reduction {
|
||||||
|
// Perform a black alpha reduction before color type reductions
|
||||||
|
// This can allow reductions from alpha to indexed which may not have been possible otherwise
|
||||||
|
if !opts.alphas.is_empty() {
|
||||||
|
if let Some(reduced) = filtered_alpha_channel(&png, AlphaOptim::Black) {
|
||||||
|
png = Arc::new(reduced);
|
||||||
|
}
|
||||||
|
}
|
||||||
if let Some(reduced) = reduce_color_type(&png, opts.grayscale_reduction) {
|
if let Some(reduced) = reduce_color_type(&png, opts.grayscale_reduction) {
|
||||||
png = Arc::new(reduced);
|
png = Arc::new(reduced);
|
||||||
eval.try_image(png.clone());
|
eval.try_image(png.clone());
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ use crate::bit_depth::reduce_bit_depth_8_or_less;
|
||||||
pub mod color;
|
pub mod color;
|
||||||
use crate::color::*;
|
use crate::color::*;
|
||||||
|
|
||||||
pub(crate) use crate::alpha::try_alpha_reductions;
|
pub(crate) use crate::alpha::{filtered_alpha_channel, try_alpha_reductions};
|
||||||
pub(crate) use crate::bit_depth::reduce_bit_depth;
|
pub(crate) use crate::bit_depth::reduce_bit_depth;
|
||||||
|
|
||||||
/// Attempt to reduce the number of colors in the palette
|
/// Attempt to reduce the number of colors in the palette
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue