Skip to content

Commit

Permalink
Add a link to zune-jpeg docs
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenzV committed Nov 27, 2024
1 parent 23dd5ab commit d038c60
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/resvg/src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ mod raster_images {
let data = decoder.decode().ok()?;
match output_cs {
ColorSpace::RGBA => data,
// For some reason zune jpeg won't coerce luma JPEGs into RGBA, so we do it manually.
// `set_output_color_space` is not guaranteed to actually always set the output space
// to RGBA (see https://docs.rs/zune-core/latest/zune_core/options/struct.DecoderOptions.html#method.jpeg_set_out_colorspace).
// In particular, it seems like it doesn't work for luma JPEGs,
// so we convert them manually.
ColorSpace::Luma => data
.into_iter()
.flat_map(|p| [p, p, p, 255])
Expand Down

0 comments on commit d038c60

Please sign in to comment.