Skip to content

Commit

Permalink
fix png compression setting (#669)
Browse files Browse the repository at this point in the history
  • Loading branch information
prybalko authored Jul 27, 2023
1 parent 21f1b80 commit a447205
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ serde_json = "1.0"
octocrab = "0.19.0"
tokio = { version = "1", features = ["full"] }
reqwest = { version = "0.11", features = ["json", "blocking"]}
png = "0.17.5"
png = "0.17.8"
blake2-rfc = "0.2.18"
# Hash table which preserves insertion order
indexmap = {version="1", features=["serde"]}
Expand Down
4 changes: 2 additions & 2 deletions cli/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::io::BufWriter;
use std::path::Path;

use anyhow::Result;
use png::Encoder;
use serde::{Deserialize, Serialize};
use sp_core::H256;
use tempfile::tempdir;
Expand All @@ -29,7 +28,7 @@ pub(crate) fn save_source_info(path: &Path, source: &Source) -> Result<()> {
let out_path = tmp_dir.path().join("qr.apng");
let file = File::create(&out_path).unwrap();
let w = &mut BufWriter::new(file);
let mut encoder = Encoder::new(w, in_info.width, in_info.height);
let mut encoder = png::Encoder::new(w, in_info.width, in_info.height);
encoder.set_color(in_info.color_type);
encoder.set_depth(in_info.bit_depth);
if let Some(palette) = in_info.palette.clone() {
Expand All @@ -42,6 +41,7 @@ pub(crate) fn save_source_info(path: &Path, source: &Source) -> Result<()> {
encoder.set_frame_delay(frame.delay_num, frame.delay_den)?;
}
encoder.add_ztxt_chunk(SOURCE.to_string(), serde_json::to_string(source)?)?;
encoder.set_compression(png::Compression::Best);

let mut writer = encoder.write_header().unwrap();

Expand Down

0 comments on commit a447205

Please sign in to comment.