You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem: png's encoded by lodepng seem to lack text_keys, as seen by the png crate and a certain non-rust closed-source application that i care about.
Given png's very strongly worded claims of standard compliance (and that png-produced images are recognized by the aforementioned non-rust application, whereas the lodepng ones are not), i assume the fault lies with lodepng.
Sadly i have not delved deep enough into the standard to provide any more specifics.
Code demonstrating the issue:
externcrate lodepng;externcrate png;fnmain(){let image = vec![255u8,0,0,255];// single red pixelletmut encoder = lodepng::Encoder::new();
encoder.info_png_mut().add_text("hello","world").unwrap();let encoded_image = encoder.encode(&image,1,1).unwrap();// parse it back{println!("\n -- lodepng view of the metadata:");letmut decoder = lodepng::Decoder::new();let decoded = decoder.decode(&encoded_image).unwrap();// displays keys properlyprintln!("the following text keys are present:");for(k, v)in decoder.info_png().text_keys(){println!("{:?} - {:?}",
std::str::from_utf8(k),
std::str::from_utf8(v),)}}{println!("\n -- png view of the metadata:");let decoder = png::Decoder::new(encoded_image.as_slice());letmut r = decoder.read_info().unwrap();println!("{:?}", r.info());// displays nothingprintln!(" compressed text: {:?}\n uncompressed text: {:?}",
r.info().compressed_latin1_text,
r.info().uncompressed_latin1_text
);}}
Output:
-- lodepng view of the metadata:
the following text keys are present:
Ok("hello") - Ok("world")
-- png view of the metadata:
Info { width: 1, height: 1, bit_depth: Eight, color_type: Rgb, interlaced: false, trns: None, pixel_dims: None, palette: None, gama_chunk: None, chrm_chunk: None, frame_control: None, animation_control: None, compression: Fast, source_gamma: None, source_chromaticities: None, srgb: None, icc_profile: None, uncompressed_latin1_text: [], compressed_latin1_text: [], utf8_text: [] }
compressed text: []
uncompressed text: []
The text was updated successfully, but these errors were encountered:
Yes, i have. It's empty as well (again, as per png crate; i have not inspected the encoded bytes).
Playing with encoder.set_text_compression() does not change things either.
Problem: png's encoded by
lodepng
seem to lack text_keys, as seen by thepng
crate and a certain non-rust closed-source application that i care about.Given
png
's very strongly worded claims of standard compliance (and thatpng
-produced images are recognized by the aforementioned non-rust application, whereas thelodepng
ones are not), i assume the fault lies withlodepng
.Sadly i have not delved deep enough into the standard to provide any more specifics.
Code demonstrating the issue:
Output:
The text was updated successfully, but these errors were encountered: