Struct dagpirs::image::Image [−][src]
pub struct Image { /* fields omitted */ }
Image Manipulation Functions for async client.
Implementations
impl Image
[src]
impl Image
[src]pub fn new(http: Arc<Client>) -> Self
[src]
pub async fn image_process(
&self,
url: String,
manipulation: ImageManipulation
) -> HttpResult<ImageResponse, String>
[src]
&self,
url: String,
manipulation: ImageManipulation
) -> HttpResult<ImageResponse, String>
Sample Image Processing This example processes a URL and saves a format aware Image
Example
use dagpirs::{Client, Bytes}; // Only here the std fs is used, in prod for async use the tokio::fs; use std::fs; use std::io::Write; use tokio; #[tokio::main] async fn main() { let token = std::env::var("DAGPI_TOKEN").unwrap(); let c = Client::new(&token).unwrap(); if let Ok(i) = c.image.image_process("https://dagpi.xyz/dagpi.png".to_string(), dagpirs::models::ImageManipulation::Wanted).await { match i { Ok(im) => { let buff: Bytes = im.bytes; let mut f = fs::File::create(format!("wanted.{}", im.format)).unwrap(); f.write_all(buff.to_vec().as_slice()).unwrap(); }, Err(e) => panic!("{}", e) } } }
pub async fn image_process_text(
&self,
url: String,
text: String,
manipulation: ImageManipulationText
) -> HttpResult<ImageResponse, String>
[src]
&self,
url: String,
text: String,
manipulation: ImageManipulationText
) -> HttpResult<ImageResponse, String>
Process an image with text
pub async fn image_process_top_bottom(
&self,
url: String,
top_text: String,
bottom_text: String,
manipulation: ImageManipulationTopBottom
) -> HttpResult<ImageResponse, String>
[src]
&self,
url: String,
top_text: String,
bottom_text: String,
manipulation: ImageManipulationTopBottom
) -> HttpResult<ImageResponse, String>
Process and Image with both top and bottom text
pub async fn tweet(
&self,
url: String,
username: String,
text: String
) -> HttpResult<ImageResponse, String>
[src]
&self,
url: String,
username: String,
text: String
) -> HttpResult<ImageResponse, String>
Generate a realistic fake tweet
pub async fn yt(
&self,
url: String,
username: String,
text: String,
dark: bool
) -> HttpResult<ImageResponse, String>
[src]
&self,
url: String,
username: String,
text: String,
dark: bool
) -> HttpResult<ImageResponse, String>
Generate a realistic fake youtube comment
pub async fn discord_message(
&self,
url: String,
username: String,
text: String,
dark: bool
) -> HttpResult<ImageResponse, String>
[src]
&self,
url: String,
username: String,
text: String,
dark: bool
) -> HttpResult<ImageResponse, String>
Generate a realistic fake discord message
pub async fn pride(
&self,
url: String,
flag: Pride
) -> HttpResult<ImageResponse, String>
[src]
&self,
url: String,
flag: Pride
) -> HttpResult<ImageResponse, String>
Put a pride flag overlay over an image from a selection of pride flags
Auto Trait Implementations
impl !RefUnwindSafe for Image
impl !RefUnwindSafe for Image
impl !UnwindSafe for Image
impl !UnwindSafe for Image
Blanket Implementations
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]