{ "name": "libwebp", "version": "1.6.0", "summary": "libwebp: WebP images (encoder, decoder, mux and demux) for PHP's gd and ImageMagick; cwebp, dwebp, gif2webp and img2webp read PNG, JPEG and GIF", "category": "library", "license": "BSD-3-Clause", "homepage": "https://developers.google.com/speed/webp", "source": { "url": "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.6.0.tar.gz", "sha256": "e4ab7009bf0629fd11982d4c2aa83964cf244cffba7347ecd39019a9e38c4564" }, "watch": { "kind": "github-tag", "repo": "webmproject/libwebp", "tag_regex": "^v([0-9]+\\.[0-9]+\\.[0-9]+)$" }, "deps": [ "libpng", "libjpeg-turbo", "giflib" ], "env_packages": [], "static": true, "nss": false, "check": "t=$(mktemp -d) && { printf 'P6\\n8 8\\n255\\n'; for i in $(seq 1 64); do printf '\\x80\\x40\\xc0'; done; } > \"$t/a.ppm\" && check_static bin/cwebp bin/dwebp bin/gif2webp bin/img2webp bin/webpmux bin/webpinfo && bin/cwebp -quiet -lossless \"$t/a.ppm\" -o \"$t/a.webp\" && bin/webpinfo -quiet \"$t/a.webp\" && bin/webpmux -info \"$t/a.webp\" | has -i 'canvas size: *8 x 8' && bin/dwebp -quiet \"$t/a.webp\" -ppm -o \"$t/b.ppm\" && cmp -s \"$t/a.ppm\" \"$t/b.ppm\" && python3 -c 'import sys, zlib, struct; w = h = 32; raw = b\"\".join(b\"\\0\" + bytes(v for x in range(w) for v in ((x * 8) % 256, (y * 8) % 256, ((x + y) * 4) % 256, 255)) for y in range(h)); c = lambda t, d: struct.pack(\">I\", len(d)) + t + d + struct.pack(\">I\", zlib.crc32(t + d)); open(sys.argv[1], \"wb\").write(b\"\\x89PNG\\r\\n\\x1a\\n\" + c(b\"IHDR\", struct.pack(\">IIBBBBB\", w, h, 8, 6, 0, 0, 0)) + c(b\"IDAT\", zlib.compress(raw, 0)) + c(b\"IEND\", b\"\"))' \"$t/a.png\" && bin/cwebp -quiet -q 92 -m 6 \"$t/a.png\" -o \"$t/p.webp\" && bin/webpmux -info \"$t/p.webp\" | has -i 'canvas size: *32 x 32' && bin/dwebp -quiet \"$t/p.webp\" -o \"$t/p.png\" && od -An -tx1 -N8 \"$t/p.png\" | tr -d ' \\n' | has -x 89504e470d0a1a0a && bin/cjpeg -quality 90 -outfile \"$t/a.jpg\" \"$t/a.ppm\" && bin/cwebp -quiet \"$t/a.jpg\" -o \"$t/j.webp\" && bin/webpinfo -quiet \"$t/j.webp\" && printf '%s' 'R0lGODlhEAAMAPAAAMBAIAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQACgAAACwAAAAAEAAMAAACDISPqcvtD6OctNprCgAh+QQACgAAACwAAAAAEAAMAIAgQMAAAAACDISPqcvtD6OctNprCgA7' | base64 -d > \"$t/a.gif\" && bin/gif2webp -quiet \"$t/a.gif\" -o \"$t/g.webp\" && bin/webpmux -info \"$t/g.webp\" | has -i 'number of frames: *2' && check_lib libwebp 'webp/encode.h webp/decode.h' 'unsigned char px[16 * 8 * 3], *enc = NULL, *dec; int w, h; for (int i = 0; i < (int) sizeof px; i++) px[i] = (unsigned char) (i * 13); size_t n = WebPEncodeLosslessRGB(px, 16, 8, 48, &enc); if (!n) return 1; dec = WebPDecodeRGB(enc, n, &w, &h); if (!dec || w != 16 || h != 8 || memcmp(px, dec, sizeof px)) return 2; WebPFree(enc); WebPFree(dec); n = WebPEncodeRGB(px, 16, 8, 48, 75, &enc); if (!n || !WebPGetInfo(enc, n, &w, &h) || w != 16) return 3; WebPFree(enc)'; r=$?; rm -rf -- \"${t:?}\"; [ $r = 0 ] && echo \"libwebp $(bin/cwebp -version | first): cwebp -lossless, webpinfo, webpmux and dwebp give a PPM back byte for byte; cwebp converts a PNG and a JPEG, dwebp writes PNG, gif2webp makes a two-frame animated WebP; the C API encodes lossless (decoded byte for byte) and lossy\"; exit $r" }