Search the Community
Showing results for tags 'webp'.
-
Does anyone know where to find the fileformats PixiJS supports? Or is the support simply the same as the browser support for file formats? To be more specific: does PixiJS support the WebP fileformat? It would be great if it did, since WebP offers better and higher compression than PNG and JPG.
-
Hi all, I got WebPs with Alpha working; however, the WebP is animated (or should be). It isn't playing in Phaser. I'm assuming this isn't supported and I'm SOL; however, I just wanted to check. Does anyone know how to get animated WebPs to play in Phaser?? Please don't suggest using spritesheets -- I'm writing a demo that leverages an API that delivers animated webps, so for this purpose, I need to play animated webps. Thanks!
-
Hi, loading webp using Phaser 2.3.0 doesnt work for me (except in Chrome), so I'm trying to figure out a workaround. by using http://libwebpjs.appspot.com/v0.1.3/ Im basically doing this: var ba = game.cache.getBinary('webp_test'); var WebPImage = window.WEBP_decode(ba); trace(WebPImage); var bd2 = this.game.add.bitmapData(WebPImage.width, WebPImage.height); bd2.data = WebPImage.data; trace(bd2); game.add.sprite(0,0, bd2);on the two traces above Im getting Decoded %s. Dimensions: 2048 x 1024(no alpha). Now saving...webp.js (line 1)ImageData { width=2048, height=1024, data=Uint8ClampedArray}webp.js (line 1)Object { game={...}, key="bc989398-4d18-4bff-ad72-91e6b10ff33a", width=2048, more...}webp.js (line 1)which I thought looked ok. however, no image is shown when I add the sprite this is how the WEBP_decode looks like : which works, but only on RGB888 webp (no alpha) window.WEBP_decode = function(data) { ///libwebpjs 0.1.3 decoder code start --------------------------------------------- var WebPImage = { width:{value:0},height:{value:0} }; var decoder = new WebPDecoder();// data=convertBinaryToArray(data);//unkonvertierung in char trace(data.length); //Config, you can set all arguments or what you need, nothing no objeect var config = decoder.WebPDecoderConfig; var output_buffer = config.output; var bitstream = config.input; if (!decoder.WebPInitDecoderConfig(config)) { alert("Library version mismatch!\n"); return -1; } config.options.no_fancy_upsampling = 0; config.options.bypass_filtering = 0; config.options.use_threads = 1; config.options.use_cropping= 0;// config.options.crop_left = parseInt(cropDecoding_x.value);// config.options.crop_top = parseInt(cropDecoding_y.value);// config.options.crop_width = parseInt(cropDecoding_w.value);// config.options.crop_height = parseInt(cropDecoding_h.value); //config.options.use_scaling = 1;//not implement //config.options.scaled_width = 400; //config.options.scaled_height = 400; //todo: add stop_watch var StatusCode = decoder.VP8StatusCode; var status = decoder.WebPGetFeatures(data, data.length, bitstream); if (status != StatusCode.VP8_STATUS_OK) { trace('error decoding: ' + status); } var mode = decoder.WEBP_CSP_MODE; //output_buffer.colorspace = bitstream.has_alpha.value ? MODE_BGRA : MODE_BGR; //output_buffer.colorspace = bitstream.has_alpha.value ? MODE_RGBA : MODE_RGB; output_buffer.colorspace = mode.MODE_RGBA; status = decoder.WebPDecode(data, data.length, config); var ok = (status == StatusCode.VP8_STATUS_OK); if (!ok) { trace("Decoding of %s failed.\n"); //fprintf(stderr, "Status: %d (%s)\n", status, kStatusMessages[status]); return -1; } trace("Decoded %s. Dimensions: "+output_buffer.width+" x "+output_buffer.height+""+(bitstream.has_alpha.value ? " (with alpha)" : "(no alpha)")+". Now saving...\n"); var bitmap = output_buffer.u.RGBA.rgba; ///libwebpjs 0.1.3 decoder code end --------------------------------------------- if (bitmap) { //Draw Image var biHeight=output_buffer.height; var biWidth=output_buffer.width; var canvas = document.createElement('canvas'); canvas.height=biHeight; canvas.width=biWidth; var context = canvas.getContext('2d'); var output = context.createImageData(canvas.width, canvas.height); var outputData = output.data; for (var h=0;h<biHeight;h++) { for (var w=0;w<biWidth;w++) { outputData[2+w*4+(biWidth*4)*h] = bitmap[2+w*4+(biWidth*4)*h]; outputData[1+w*4+(biWidth*4)*h] = bitmap[1+w*4+(biWidth*4)*h]; outputData[0+w*4+(biWidth*4)*h] = bitmap[0+w*4+(biWidth*4)*h]; outputData[3+w*4+(biWidth*4)*h] = bitmap[3+w*4+(biWidth*4)*h]; }; } return output; context.putImageData(output, 0, 0); //document.body.appendChild(canvas); // to test it out, which works OK } } any ideas why the bitmapData doesnt work?