MCPcopy Index your code
hub / github.com/ImageOptim/libimagequant / getRemapped

Method getRemapped

imagequant-sys/org/pngquant/Result.java:24–37  ·  view source on GitHub ↗

@return BufferedImage remapped to palette this Result has been created with or null on failure.

(Image orig_image)

Source from the content-addressed store, hash-verified

22 * @return BufferedImage remapped to palette this Result has been created with or null on failure.
23 */
24 public BufferedImage getRemapped(Image orig_image) {
25 byte[] pal = liq_get_palette(handle);
26 IndexColorModel color = new IndexColorModel(8, pal.length/4, pal, 0, true);
27 BufferedImage img = new BufferedImage(
28 orig_image.getWidth(), orig_image.getHeight(),
29 BufferedImage.TYPE_BYTE_INDEXED, color);
30
31 byte[] data = get8bitDataFromImage(img);
32 if (data == null) return null;
33
34 if (!liq_write_remapped_image(handle, orig_image.handle, data)) return null;
35
36 return img;
37 }
38
39 /**
40 * Dithering strength. Floyd-Steinberg is always used and in

Callers 1

getRemappedMethod · 0.95

Calls 5

liq_get_paletteMethod · 0.95
get8bitDataFromImageMethod · 0.95
getWidthMethod · 0.80
getHeightMethod · 0.80

Tested by

no test coverage detected