Skip to content

Commit

Permalink
update image dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
robatipoor committed Aug 1, 2020
1 parent 8d528c8 commit 8c8f9d2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ homepage = "https://github.com/daniel-e/captcha"
repository = "https://github.com/daniel-e/captcha"

[dependencies]
image = "0.13.0"
image = "0.23.8"
rand = "0.7.3"
serde_json = "1.0.57"
base64 = "0.12.3"
Expand Down
7 changes: 3 additions & 4 deletions src/images/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use std::cmp::{max, min};
use std::io::Result;
use std::iter::FromIterator;
use std::path::Path;

use image::error::ImageResult;
use image::{load_from_memory, ImageBuffer, Rgb, RgbImage};
use lodepng;

Expand Down Expand Up @@ -63,7 +62,7 @@ impl Image {
pub fn get_pixel(&self, x: u32, y: u32) -> Pixl {
let p = *self.img.get_pixel(x, y);
Pixl {
rgb: [p.data[0], p.data[1], p.data[2]],
rgb: [p.0[0], p.0[1], p.0[2]],
}
}

Expand All @@ -75,7 +74,7 @@ impl Image {
self.img.height()
}

pub fn save(&self, p: &Path) -> Result<()> {
pub fn save(&self, p: &Path) -> ImageResult<()> {
self.img.save(p)
}

Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ mod fonts;
mod images;
mod samples;

pub use samples::{by_name, gen, CaptchaName, Difficulty};

use filters::Filter;
use fonts::{Default, Font};
use image::error::ImageResult;
use images::{Image, Pixl};
pub use samples::{by_name, gen, CaptchaName, Difficulty};

use rand::seq::SliceRandom;
use rand::thread_rng;
Expand Down Expand Up @@ -145,7 +145,7 @@ impl Captcha {
///
/// The format that is written is determined from the filename's extension. On error `Err` is
/// returned.
pub fn save(&self, p: &Path) -> Result<()> {
pub fn save(&self, p: &Path) -> ImageResult<()> {
self.img.save(p)
}

Expand Down

0 comments on commit 8c8f9d2

Please sign in to comment.