MCPcopy Create free account
hub / github.com/ImageOptim/libimagequant / set_importance_map

Method set_importance_map

src/image.rs:177–184  ·  view source on GitHub ↗

Set which pixels are more important (and more likely to get a palette entry) The map must be `width`×`height` pixels large. Higher numbers = more important.

(&mut self, map: impl Into<Box<[u8]>>)

Source from the content-addressed store, hash-verified

175 ///
176 /// The map must be `width`×`height` pixels large. Higher numbers = more important.
177 pub fn set_importance_map(&mut self, map: impl Into<Box<[u8]>>) -> Result<(), Error> {
178 let map = map.into();
179 if map.len() != self.width() * self.height() {
180 return Err(BufferTooSmall);
181 }
182 self.importance_map = Some(map);
183 Ok(())
184 }
185
186 /// Remap pixels assuming they will be displayed on this background. This is designed for GIF's "keep" mode.
187 ///

Callers 2

set_importance_mapFunction · 0.80

Calls 3

lenMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45

Tested by 1

set_importance_mapFunction · 0.64