Skip to content

Commit cd034cd

Browse files
committed
fix a bug in gifs
1 parent f3a62a6 commit cd034cd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/algorithm/media.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -931,9 +931,9 @@ fn encode_gif_impl<C, E>(
931931
let mut frame = Frame::from_indexed_pixels(width as u16, height as u16, indices, Some(0));
932932
frame.delay = ((i + 1) as f64 * 100.0 / frame_rate).round() as u16 - t;
933933
frame.dispose = if has_transparent {
934-
DisposalMethod::Any
935-
} else {
936934
DisposalMethod::Background
935+
} else {
936+
DisposalMethod::Any
937937
};
938938
t += frame.delay;
939939
encoder
@@ -994,7 +994,7 @@ where
994994
if width > 0 && height > 0 {
995995
for (i, frame) in data.chunks_exact(width * height).enumerate() {
996996
let frame: Vec<u8> = frame.iter().map(|&x| (x.to_f64() * 255.0) as u8).collect();
997-
let mut frame = Frame::from_indexed_pixels(width as u16, height as u16, frame, Some(0));
997+
let mut frame = Frame::from_indexed_pixels(width as u16, height as u16, frame, None);
998998
frame.delay = ((i + 1) as f64 * 100.0 / frame_rate).round() as u16 - t;
999999
t += frame.delay;
10001000
encoder.write_frame(&frame).map_err(|e| e.to_string())?;

0 commit comments

Comments
 (0)