Skip to content

Commit

Permalink
feat: Add support for webp (#98)
Browse files Browse the repository at this point in the history
Signed-off-by: Shinyzenith <[email protected]>

---------

Signed-off-by: Shinyzenith <[email protected]>
Co-authored-by: Shinyzenith <[email protected]>
  • Loading branch information
Gigas002 and Shinyzenith authored Mar 23, 2024
1 parent d7200c7 commit 017be62
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/wayshot.1.scd
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,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 @@ -58,6 +58,8 @@ pub enum EncodingFormat {
Ppm,
/// Qut encoder.
Qoi,
/// WebP encoder,
Webp,
}

impl Default for EncodingFormat {
Expand All @@ -73,6 +75,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 @@ -111,6 +114,7 @@ impl From<EncodingFormat> for &str {
EncodingFormat::Png => "png",
EncodingFormat::Ppm => "ppm",
EncodingFormat::Qoi => "qoi",
EncodingFormat::Webp => "webp",
}
}
}
Expand Down

0 comments on commit 017be62

Please sign in to comment.