Skip to content
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

Add support for webp #98

Merged
merged 6 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/wayshot.1.scd
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Wayshot - Screenshot tool for compositors implementing zwlr_screencopy_v1 such a
- png (Default encoder)
- ppm
- qoi
- webp

*-f*, *--file*
Set a custom file path. The default path is `./{current_unix_timestamp}-wayshot.{encoder}`
Expand Down
1 change: 1 addition & 0 deletions wayshot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ image = { version = "0.24", default-features = false, features = [
"png",
"pnm",
"qoi",
"webp-encoder",
] }

dialoguer = { version = "0.11.0", features = ["fuzzy-select"] }
Expand Down
4 changes: 4 additions & 0 deletions wayshot/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ pub enum EncodingFormat {
Ppm,
/// Qut encoder.
Qoi,
/// WebP encoder,
Webp,
}

impl Default for EncodingFormat {
Expand All @@ -77,6 +79,7 @@ impl From<EncodingFormat> for image::ImageOutputFormat {
EncodingFormat::Png => image::ImageFormat::Png.into(),
EncodingFormat::Ppm => image::ImageFormat::Pnm.into(),
EncodingFormat::Qoi => image::ImageFormat::Qoi.into(),
EncodingFormat::Webp => image::ImageFormat::WebP.into(),
}
}
}
Expand Down Expand Up @@ -115,6 +118,7 @@ impl From<EncodingFormat> for &str {
EncodingFormat::Png => "png",
EncodingFormat::Ppm => "ppm",
EncodingFormat::Qoi => "qoi",
EncodingFormat::Webp => "webp",
}
}
}
Expand Down
Loading