Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion xcommon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = "Apache-2.0 OR MIT"
anyhow = "1.0.68"
byteorder = "1.4.3"
dunce = "1"
image = { version = "0.24.5", default-features = false, features = ["png", "webp"] }
image = { version = "0.25.5", default-features = false, features = ["png", "webp"] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love to see if 0.25.0 would work equally well :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly, it doesn't. But 0.25.2 does.

pem = "1.1.0"
rasn = "0.6.1"
rasn-pkix = "0.6.0"
Expand Down
10 changes: 5 additions & 5 deletions xcommon/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ pub mod llvm;

use anyhow::{Context, Result};
use byteorder::{LittleEndian, ReadBytesExt};
use image::imageops::FilterType;
use image::io::Reader as ImageReader;
use image::{DynamicImage, GenericImageView, ImageOutputFormat, RgbaImage};
use image::ImageReader;
use image::{imageops::FilterType, ImageFormat};
use image::{DynamicImage, GenericImageView, RgbaImage};
use rsa::pkcs8::DecodePrivateKey;
use rsa::{PaddingScheme, RsaPrivateKey, RsaPublicKey};
use sha2::{Digest, Sha256};
Expand Down Expand Up @@ -64,13 +64,13 @@ impl Scaler {
.img
.resize(opts.scaled_size, opts.scaled_size, FilterType::Nearest);
if opts.scaled_size == opts.target_width && opts.scaled_size == opts.target_height {
resized.write_to(w, ImageOutputFormat::Png)?;
resized.write_to(w, ImageFormat::Png)?;
} else {
let x = (opts.target_width - opts.scaled_size) / 2;
let y = (opts.target_height - opts.scaled_size) / 2;
let mut padded = RgbaImage::new(opts.target_width, opts.target_height);
image::imageops::overlay(&mut padded, &resized, x as i64, y as i64);
padded.write_to(w, ImageOutputFormat::Png)?;
padded.write_to(w, ImageFormat::Png)?;
}
Ok(())
}
Expand Down
Loading