New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PNG Output does not support transparency #4088
Comments
So, this works: diff --git a/crates/typst-cli/src/compile.rs b/crates/typst-cli/src/compile.rs
index e145a820..a3b72022 100644
--- a/crates/typst-cli/src/compile.rs
+++ b/crates/typst-cli/src/compile.rs
@@ -331,7 +331,7 @@ fn export_image_page(
) -> StrResult<()> {
match fmt {
ImageExportFormat::Png => {
- let pixmap = typst_render::render(frame, command.ppi / 72.0, Color::WHITE);
+ let pixmap = typst_render::render(frame, command.ppi / 72.0, Color::WHITE.with_alpha(0.));
let buf = pixmap
.encode_png()
.map_err(|err| eco_format!("failed to encode PNG file ({err})"))?; it lets me produce an image like this: by running With this change, It does change a default though, I'm not sure what people (maintainers) think about that? |
There was some discussion about this on the Discord, starting with this message: https://discord.com/channels/1054443721975922748/1088371867913572452/1237388946946658304 |
@laurmaedje thanks, am I correct in that this
is the preferred solution then? and someone said they would work on it and then disappeared for a bit? I might just try and do it myself if that's an acceptable solution |
Have something that appears to work, but it's a total shot in the dark from me b/c I've never worked on this project before. I will open a PR later tonight after I eat dinner. |
Description
Synopsis
Setting no background results in a transparent svg, but opaquely white png.
Example
Results in
SVG
PNG
Reproduction URL
No response
Operating system
Web app, Linux
Typst version
The text was updated successfully, but these errors were encountered: