Add support for WebP file format #223

Closed
opened 2026-10-04 23:48:03 +02:00 by adam · 18 comments
Owner

Reported by brylie on 20 Apr 2013 05:57

Version: 2.5.1

WebP is becoming a robust image format, and possible replacement for JPEG, Gif, and PNG. Please put WebP support on the Piwigo roadmap :-)
https://developers.google.com/speed/webp/

Piwigo Bugtracker #2893

**Reported by brylie on 20 Apr 2013 05:57** **Version:** 2.5.1 WebP is becoming a robust image format, and possible replacement for JPEG, Gif, and PNG. Please put WebP support on the Piwigo roadmap :-) https://developers.google.com/speed/webp/ [Piwigo Bugtracker #2893](http://piwigo.org/bugs/view.php?id=2893) <!-- github-sync-id:97226564 -->
adam closed this issue 2026-10-04 23:48:03 +02:00
Author
Owner

Comment posted by brylie on 20 Apr 2013 06:00

This library may be helpful:
https://github.com/rsky/php-webp

**Comment posted by brylie on 20 Apr 2013 06:00** This library may be helpful: https://github.com/rsky/php-webp <!-- github-comment-id:124893065 -->
Author
Owner

Comment posted by flop25 on 22 Apr 2013 16:46

If all the major web browser support it, and if a world-wide used lib like ImageMagik supports it, we will consider to support it

**Comment posted by flop25 on 22 Apr 2013 16:46** If all the major web browser support it, and if a world-wide used lib like ImageMagik supports it, we will consider to support it <!-- github-comment-id:124893080 -->
Author
Owner

Comment posted by lildadou on 24 Apr 2013 22:03

--- BEGIN FRENCH ---
Le support n'est pas encore généralisé (http://caniuse.com/#feat=webp ) mais dans la mesure où JPEG est à l'image ce que le MPEG3 est à l'audio (un format vieillissant complètement dépassée scientifiquement et trop répandu), que Facebook est en passe de faire du WebP un format industriel (http://news.cnet.com/8301-1023_3-57580664-93/facebook-tries-googles-webp-image-format-users-squawk/ ) et qu'ImageMagick supporte ce format depuis bientôt 2 ans (http://imagemagick.org/script/formats.php ), je pense qu'il n'est pas prématuré de s'attaquer à la prise en charge de ce format.

On peut commencer par une prise en charge de l'extension webp par défaut. Ce serai plus un signe qu'autre chose. Ensuite la génération de miniatures en WebP lorsque les originaux sont en WebP?
--- END FRENCH ---

**Comment posted by lildadou on 24 Apr 2013 22:03** --- BEGIN FRENCH --- Le support n&#039;est pas encore généralisé (http://caniuse.com/#feat=webp ) mais dans la mesure où JPEG est à l&#039;image ce que le MPEG3 est à l&#039;audio (un format vieillissant complètement dépassée scientifiquement et trop répandu), que Facebook est en passe de faire du WebP un format industriel (http://news.cnet.com/8301-1023_3-57580664-93/facebook-tries-googles-webp-image-format-users-squawk/ ) et qu&#039;ImageMagick supporte ce format depuis bientôt 2 ans (http://imagemagick.org/script/formats.php ), je pense qu&#039;il n&#039;est pas prématuré de s&#039;attaquer à la prise en charge de ce format. On peut commencer par une prise en charge de l&#039;extension webp par défaut. Ce serai plus un signe qu&#039;autre chose. Ensuite la génération de miniatures en WebP lorsque les originaux sont en WebP? --- END FRENCH --- <!-- github-comment-id:124893096 -->
Author
Owner

Comment posted by brylie on 26 Apr 2013 05:24

ImageMagick WebP:
http://www.imagemagick.org/script/webp.php

PHP WebP:
http://php.net/manual/en/function.imagewebp.php

Browser support:
https://en.wikipedia.org/wiki/Webp#Support

**Comment posted by brylie on 26 Apr 2013 05:24** ImageMagick WebP: http://www.imagemagick.org/script/webp.php PHP WebP: http://php.net/manual/en/function.imagewebp.php Browser support: https://en.wikipedia.org/wiki/Webp#Support <!-- github-comment-id:124893105 -->
Author
Owner

Comment posted by flop25 on 1 May 2013 20:48

Si if IM supports it, could you try in Piwigo webp? set $conf['picture_ext'] and $conf['file_ext']

**Comment posted by flop25 on 1 May 2013 20:48** Si if IM supports it, could you try in Piwigo webp? set $conf[&#039;picture_ext&#039;] and $conf[&#039;file_ext&#039;] <!-- github-comment-id:124893119 -->
Author
Owner

Comment posted by brylie on 2 May 2013 04:09

Thanks flop25. Can you please provide explicit instructions on how to modify $conf['picture_ext'] and $conf['file_ext']?

**Comment posted by brylie on 2 May 2013 04:09** Thanks flop25. Can you please provide explicit instructions on how to modify $conf[&#039;picture_ext&#039;] and $conf[&#039;file_ext&#039;]? <!-- github-comment-id:124893134 -->
Author
Owner

Comment posted by flop25 on 3 May 2013 15:46

Check the Doc about the local configuration

**Comment posted by flop25 on 3 May 2013 15:46** Check the Doc about the local configuration <!-- github-comment-id:124893143 -->
Author
Owner

Comment posted by lildadou on 3 May 2013 21:48

I make the test on:
Piwigo 2.5.1
PHP: 5.3.10-1ubuntu3.6 (Montrer les informations) [2013-05-03 23:41:21]
MySQL: 5.5.31-0ubuntu0.12.04.1 [2013-05-03 23:41:21]
Bibliothèque graphique: External ImageMagick 6.6.9-7
Webp encoder: webp 0.1.3-2.1ubunt (lastest 0.3.0)

Server return: "[Image] unsupported file extension"
:'(

Edit: My version of ImageMagick was not compiled with WebP support. I will compile IM himself

**Comment posted by lildadou on 3 May 2013 21:48** I make the test on: Piwigo 2.5.1 PHP: 5.3.10-1ubuntu3.6 (Montrer les informations) [2013-05-03 23:41:21] MySQL: 5.5.31-0ubuntu0.12.04.1 [2013-05-03 23:41:21] Bibliothèque graphique: External ImageMagick 6.6.9-7 Webp encoder: webp 0.1.3-2.1ubunt (lastest 0.3.0) Server return: &quot;[Image] unsupported file extension&quot; :&#039;( Edit: My version of ImageMagick was not compiled with WebP support. I will compile IM himself <!-- github-comment-id:124893159 -->
Author
Owner

Comment posted by flop25 on 3 May 2013 23:36

Thx
could retry after changing http://piwigo.org/dev/browser/trunk/admin/include/image.class.php#L76 and of course using a compatible version of IM ^^

**Comment posted by flop25 on 3 May 2013 23:36** Thx could retry after changing http://piwigo.org/dev/browser/trunk/admin/include/image.class.php#L76 and of course using a compatible version of IM ^^ <!-- github-comment-id:124893168 -->
Author
Owner

Comment posted by lildadou on 4 May 2013 15:10

@flop25:
I install a "WebP ready" ImageMagick and i added 'webp' on http://piwigo.org/dev/browser/trunk/admin/include/image.class.php#L76
and it works (only on Chrome 26.0.1410.64).
Just care to disable GThumb+ :'(

@future_testers:
For compiling and installing ImageMagick 6.8.5-4 with WebP support on Ubuntu, you need libwep-dev 0.3.0 (the latest version). Availlable packages of libwebp-dev on Ubuntu's repositories are not recent enough ; so you need to compiling and installing libwep-dev too.

This is a script for automatize these tasks. I use checkinstall instead "make install" due to the packaging benefits (ie. you can type apt-get remove imagemagick for uninstall!)

sudo apt-get remove imagemagick libwebp-dev
sudo apt-get install libjpeg8-dev libpng12-dev libtiff4-dev
wget https://launchpad.net/imagemagick/main/6.8.5-4/+download/ImageMagick-6.8.5-4.tar.gz
wget https://webp.googlecode.com/files/libwebp-0.3.0.tar.gz
tar xf ImageMagick-6.8.5-4.tar.gz
tar xf libwebp-0.3.0.tar.gz
cd libwebp-0.3.0
./configure
make --jobs=2
sudo checkinstall --pkgname=libwebp-dev --pkgversion="0.3.0" --backup=no --deldoc=yes --fstrans=no --default
cd ../ImageMagick-6.8.5-4
./configure --with-webp
make --jobs=2
sudo checkinstall --pkgname=imagemagick --pkgversion="6.8.5-4" --backup=no --deldoc=yes --fstrans=no --default
sudo ldconfig

Ensure ImageMagick installation, "convert -list format | grep -i webp" must return like "WEBP* rw- WebP Image Format (libwebp 0.3.0)"

**Comment posted by lildadou on 4 May 2013 15:10** @flop25: I install a &quot;WebP ready&quot; ImageMagick and i added &#039;webp&#039; on http://piwigo.org/dev/browser/trunk/admin/include/image.class.php#L76 and it works (only on Chrome 26.0.1410.64). Just care to disable GThumb+ :&#039;( @future_testers: For compiling and installing ImageMagick 6.8.5-4 with WebP support on Ubuntu, you need libwep-dev 0.3.0 (the latest version). Availlable packages of libwebp-dev on Ubuntu&#039;s repositories are not recent enough ; so you need to compiling and installing libwep-dev too. This is a script for automatize these tasks. I use checkinstall instead &quot;make install&quot; due to the packaging benefits (ie. you can type apt-get remove imagemagick for uninstall!) sudo apt-get remove imagemagick libwebp-dev sudo apt-get install libjpeg8-dev libpng12-dev libtiff4-dev wget https://launchpad.net/imagemagick/main/6.8.5-4/+download/ImageMagick-6.8.5-4.tar.gz wget https://webp.googlecode.com/files/libwebp-0.3.0.tar.gz tar xf ImageMagick-6.8.5-4.tar.gz tar xf libwebp-0.3.0.tar.gz cd libwebp-0.3.0 ./configure make --jobs=2 sudo checkinstall --pkgname=libwebp-dev --pkgversion=&quot;0.3.0&quot; --backup=no --deldoc=yes --fstrans=no --default cd ../ImageMagick-6.8.5-4 ./configure --with-webp make --jobs=2 sudo checkinstall --pkgname=imagemagick --pkgversion=&quot;6.8.5-4&quot; --backup=no --deldoc=yes --fstrans=no --default sudo ldconfig Ensure ImageMagick installation, &quot;convert -list format | grep -i webp&quot; must return like &quot;WEBP\* rw- WebP Image Format (libwebp 0.3.0)&quot; <!-- github-comment-id:124893193 -->
Author
Owner

Comment posted by lildadou on 4 May 2013 15:59

Visit https://mediabunker.s0rc3r.net/piwigo/index.php?/category/410 for viewing WebP usage.
PS: you can see some bugs with the ajax loader

**Comment posted by lildadou on 4 May 2013 15:59** Visit https://mediabunker.s0rc3r.net/piwigo/index.php?/category/410 for viewing WebP usage. PS: you can see some bugs with the ajax loader <!-- github-comment-id:124893210 -->
Author
Owner

Comment posted by rvelices on 6 May 2013 20:41

no way.
in my firefox nothing is displayed with webp from your page - https://mediabunker.s0rc3r.net/piwigo/index.php?/category/410

**Comment posted by rvelices on 6 May 2013 20:41** no way. in my firefox nothing is displayed with webp from your page - https://mediabunker.s0rc3r.net/piwigo/index.php?/category/410 <!-- github-comment-id:124893219 -->
Author
Owner

Comment posted by flop25 on 6 May 2013 20:45

that's why using the conf will let the dev/admin choose
Of course Piwigo will not support by default webp until this format is massivel supported especially by all the major browsers

**Comment posted by flop25 on 6 May 2013 20:45** that&#039;s why using the conf will let the dev/admin choose Of course Piwigo will not support by default webp until this format is massivel supported especially by all the major browsers <!-- github-comment-id:124893237 -->
Author
Owner

Comment posted by lildadou on 6 May 2013 21:09

@rvelices: Firefox display WebP image only when using the markup <video> instead <image>.
Source: http://caniuse.com/#feat=webp

@flop25: If piwigo will be an early adopter then maybe it will benifit of a good visiblity :)

**Comment posted by lildadou on 6 May 2013 21:09** @rvelices: Firefox display WebP image only when using the markup &lt;video&gt; instead &lt;image&gt;. Source: http://caniuse.com/#feat=webp @flop25: If piwigo will be an early adopter then maybe it will benifit of a good visiblity :) <!-- github-comment-id:124893251 -->
Author
Owner

Comment posted by flop25 on 6 May 2013 21:42

@lildadou: well Piwigo will permit to fully manage webp and other formats so we will get that visibility by specifying webp as an example ;)
What we will not do is to force the server to manage webp files by adding webp in the default config, because its use is marginal and there is too much requirements

**Comment posted by flop25 on 6 May 2013 21:42** @lildadou: well Piwigo will permit to fully manage webp and other formats so we will get that visibility by specifying webp as an example ;) What we will not do is to force the server to manage webp files by adding webp in the default config, because its use is marginal and there is too much requirements <!-- github-comment-id:124893264 -->
Author
Owner

Hi, so what is the status of webp in Piwigo? All browsers support it, imagemagic supports it - Piwigo?

Hi, so what is the status of webp in Piwigo? All browsers support it, imagemagic supports it - Piwigo? <!-- github-comment-id:465098944 -->
Author
Owner

Hi, I'm also interested by this feature ! Any update ?

Hi, I'm also interested by this feature ! Any update ? <!-- github-comment-id:484469257 -->
Author
Owner

Regarding client support, it seems WebP has gain almost universal web-browser support. Chrome & Opera already had support. In 2018 Edge added support, in 2019 Firefox has added support.
https://caniuse.com/#feat=webp
https://developers.google.com/speed/webp/faq#which_web_browsers_natively_support_webp
The only one missing seems to be Safari. However for Safari or older browsers a javascript polyfill can be used https://github.com/chase-moskal/webp-hero . Or more simple, a html fallback method https://www.html5rocks.com/en/tutorials/responsive/picture-element/#toc-file-type

Regarding server side support, libgd and imagemagik support it. However I don't know if they are build by default with WebP support. I least my version of libgd is not compiled with webp support.
For PHP GD support can be tested like this:
<?php var_dump(gd_info()); ?>

Regarding client support, it seems WebP has gain almost universal web-browser support. Chrome & Opera already had support. In 2018 Edge added support, in 2019 Firefox has added support. https://caniuse.com/#feat=webp https://developers.google.com/speed/webp/faq#which_web_browsers_natively_support_webp The only one missing seems to be Safari. However for Safari or older browsers a javascript polyfill can be used https://github.com/chase-moskal/webp-hero . Or more simple, a html fallback method https://www.html5rocks.com/en/tutorials/responsive/picture-element/#toc-file-type Regarding server side support, libgd and imagemagik support it. However I don't know if they are build by default with WebP support. I least my version of libgd is not compiled with webp support. For PHP GD support can be tested like this: `<?php var_dump(gd_info()); ?>` <!-- github-comment-id:521574523 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#223