pub fn save_patch_to_mem(matrix: &mut Matrix) -> Vec<u8>