WebP-Tool

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

WebP-Tool

Post by [-hh] » Mon Nov 18, 2019 3:19 pm

WebP-Tool v103

WebP is a new image format for the web, see https://developers.google.com/speed/webp
All modern browsers support it already (except Safari which is currently 'on the way').

There is precompiled, BSD licensed converter software for Mac/Win/linux available. We can use it via shell():

The stack webP-Tool contains and installs (if not available) the binaries for 64bit Mac/Win/linux.
For 32bit machines see the instructions below (at end).

WebP-Tool runs, using LC 8/9, on Mac/Win/linux.

On linux libpng, libjpeg and libtiff have to be available on your OS for that.

[Encode] The webP-Tool contains the encoder cwebp for each platform.
Button "IMG -> WebP" batch converts the folder "imagesIN" to folder "webpOUT" (both in your stack's folder) and computes the reduction. Supported are .jpeg, .png or .tiff images. You can set the quality (loss amount, as with jpeg) with the slider at top, transparency is supported. RightClick does a single convert (with dialog).

[Decode] The webP-Tool contains the decoder dwebp for each platform.
Button "WebP -> PNG" converts (with dialog) a single image from webP to PNG and displays it in LiveCode. RightClick batch converts the folder "webpIN" to folder "pngOUT" (both in your stack's folder).
  • The webp-images menu at top selects from an array of webp-images (which are then converted to PNG and displayed). Import to that custom property of the card using the menu. Shift-select an item to delete it from the array.
  • Drag the icon of a png, jpeg, tif or webp file to the preview image to display it as PNG (webp is converted to png, others also by LC).
[MoreInfo] The binaries are (in total for all three platforms) compressed to 3889041 Bytes (3.709 MByte), so you have to win more than that by converting to webp to be "size-profitable" with a multi-platform product.
This goes down to around 1.3 MByte if you use the stack on one platform only (delete then the other OS-binaries which are custom properties of the stack). The compression is very good, from my experiences significantly better than jpeg.

The stack has included for mac/win/nux (all 64bit)
cwebp (WebP encoder tool), dwebp (WebP decoder tool) and webinfo (WebP info tool)
Not included are
vwebp (WebP file viewer), webpmux (WebP muxing tool), gif2webp (Tool for converting GIF images to WebP).

You can download the missing from the precompiled binaries downloads archive and use them similarly via shell(): https://storage.googleapis.com/download ... index.html

[32bit] When on a 32 bit system simply do the following (tested).
  • Download the appropriate archive for your system from https://storage.googleapis.com/download ... index.html
  • The stack creates an OS folder in the stack's folder (MAC or WIN or NUX).
    Unpack the archive and copy (replacing) cwebp, dwebp and webpinfo from the folder bin in it to that OS folder.
That's all, now the stack runs also on your system. If you need it for a standalone on a 32bit system then you can
  • delete all the binaries from the stack's properties using the property inspector.
  • show and enable the hidden btn "Load" and uncomment all OS you don't need. Then use btn "Load" to set the properties from the changed OS folder.
[Download] Stack size: 4.5 MByte.

Currently I cannot upload to "SampleStacks/livecodeshare".
So please use from the message box

Code: Select all

/*(EU)*/ go stack url ("http://hyperhh.de/xstacks/webP-Tool_v103.livecode")
/*(US)*/ go stack url ("http://hh.on-rev.com/xstacks/webP-Tool_v103.livecode")
or download
(EU) http://hyperhh.de/xstacks/webP-Tool_v103.livecode.zip
(US) http://hh.on-rev.com/xstacks/webP-Tool_ ... vecode.zip

When using go stack url, as a first action please SAVE the stack, we need the stack path for writing out the helpers and creating folders for conversion.
 
Attachments
webp.png
webp.png (24.12 KiB) Viewed 11285 times
shiftLock happens

Post Reply

Return to “Multimedia”