webP and webM support in LiveCode

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

webP and webM support in LiveCode

J. Landman Gay via use-livecode
Hi Monte,

on Thu Aug 24 2017, Monte Goulding wrote:

> webM would require a reasonable size refactor to players because
> we would need to wrap a custom player around the library and then
> decide which player to use depending on the movie file.
> webP on the other hand looks like it could be added without any
> refactoring, however, as you can imagine there is a _lot_ of work
> in adding an image format. It could be that such work is justified
> by the HTML5 project to help with file size. Failing that and given
> there’s a workaround of not using the format I imagine it would take
> a business services contract or an open source contribution to get
> it done. Then there’s considerations like whether adding the library
> to the engine is comparable in size to any savings one might make
> using the format. Not an issue for a browser that displays many websites
> but for us it would make the project a net loss.

I agree about webM, but savings in storage space provided
by webP are the best reason for implementing this image
compression format within LiveCode engine.

WebP format is between 60 and 40% smaller than JPG
images providing much better image quality.
WebP compress flat color graphics (with transparency)
much better than PNG or GIF.

This is not a guess based on visual comparisons.
Anyone could confirm these numbers, installing these
files and programs in their own computer:

0) Download these Standard Test Images
or use your own images:
http://sipi.usc.edu/database/
http://r0k.us/graphics/kodak/
http://links.uwaterloo.ca/Repository.html

1) Convert these TIFF and PNG images to
WebP (100% Quality) and (80% Quality)
https://developers.google.com/speed/webp/download

Convert these TIFF and PNG images
to JPG (100% Quality) and (87% Quality)
using GIMP, ImageMagick or your favorite
image conversion software.

Notice that webP images are between
60% and 40% smaller than visually
equivalent JPG images.

2) Install ImageMagick:
https://www.imagemagick.org/script/download.php
and compare original TIFF and PNG images
with compressed webP and JPG using
any or many of these algorithms that
measure the differences between images:

AE
    absolute error count, number of different pixels (-fuzz effected)
DDSIM
    structural dissimilarity index
FUZZ
    mean color distance
MAE
    mean absolute error (normalized), average channel error distance
MEPP
    mean error per pixel (normalized mean error, normalized peak error)
MSE
    mean error squared, average of the channel error squared
NCC
    normalized cross correlation
PAE
    peak absolute (normalized peak absolute)
PHASH
    perceptual hash for the sRGB and HCLp colorspaces.
PSNR
    peak signal to noise ratio
RMSE
    root mean squared (normalized root mean squared)
SSIM
    structural similarity index

For example:

magick compare -metric SSIM Peppers.tif PeppersQ100.webP result01.png

magick compare -metric PSNR Peppers.tif PeppersQ100.webP result01.png

Results are mind opening and confirm these findings:
https://developers.google.com/speed/webp/gallery

Remember that just 10 years ago (when Internet speed
was only 56k), JPG and GIF ruled the web, Flash movies
were harmless fun, PNG was just another novelty and
SVG was a gleam in the eyes of their creators.

Today, computers are much, much powerful than
10 years ago and image compression algorithms
have advanced using this new computer power.

Could you believe that an Android tablet from 2015
(that cost me only 5 dollars) could play HD video
much, much better than an Intel Atom PC
from 2005? (that cost more than 200 dollars)

Today, WebP and WebM could be only the new kids
on the block of image formats, but in a near future
wavelet and fractal compression could rule, offering
better quality and smaller file size than current
image formats.

Please, before ruling out completely the opportunity
to include a modern compressed image format
like webP, read the FAQ and API:

https://developers.google.com/speed/webp/faq
https://developers.google.com/speed/webp/docs/api

Al
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: webP and webM support in LiveCode

J. Landman Gay via use-livecode
I thought PNG is lossless. How can the image be better than the original??

Bob S


> On Aug 25, 2017, at 12:12 , Alejandro Tejada via use-livecode <[hidden email]> wrote:
>
> WebP compress flat color graphics (with transparency)
> much better than PNG or GIF.
>
> This is not a guess based on visual comparisons.


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: webP and webM support in LiveCode

J. Landman Gay via use-livecode
In reply to this post by J. Landman Gay via use-livecode
NVM you are talking about the compression ratio.

Bob S


> On Aug 25, 2017, at 12:12 , Alejandro Tejada via use-livecode <[hidden email]> wrote:
>
> WebP compress flat color graphics (with transparency)
> much better than PNG or GIF.
>
> This is not a guess based on visual comparisons.


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: webP and webM support in LiveCode

J. Landman Gay via use-livecode
In reply to this post by J. Landman Gay via use-livecode

> On 26 Aug 2017, at 5:12 am, Alejandro Tejada via use-livecode <[hidden email]> wrote:
>
> Please, before ruling out completely the opportunity
> to include a modern compressed image format
> like webP,

I don’t think anyone is ruling anything out.

Cheers

Monte
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: webP and webM support in LiveCode

J. Landman Gay via use-livecode
In reply to this post by J. Landman Gay via use-livecode
For webP you could use (from LC via shell) these free WebP
utilities for Mac/Win/linux:

cwebp -- WebP encoder tool
dwebp -- WebP decoder tool
vwebp -- WebP file viewer
webpmux -- WebP muxing tool
gif2webp -- Tool for converting GIF images to WebP

See https://developers.google.com/speed/webp/download
(Al gave already this link).

There is also a framework for iOS.

In linux simply do "sudo apt-get install webp" to have them,
on windows use the download link from above.

On Mac 10.12 there are these 'core' utilities already installed
in /usr/local/bin (so usable via shell):

cwebp ... encodes from png, jpeg, tiff to webP
dwebp ... decodes from webP to png or tiff

put shell(/usr/local/bin/dwebp input.webp -o output.png)
put shell(/usr/local/bin/cwebp -q 80 input.png -o output.webp)
-- q is a quality option with values from 0 up to 100 (best).

Just tested via shell from LC. Works fine and fast enough.


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode