WebPに変換するコマンド
■cwebp
・インストール
yum install libwebp-tools
通常変換
cwebp sample.jpg -o sample.webp
可逆圧縮
cwebp -lossless sample.jpg -o sample.webp
圧縮率指定(デフォルトは75?)
cwebp -q 85 sample.jpg -o sample.webp
■ImageMagick
・使えるか確認
convert -list format | grep WebP
↓こんな感じで返ってきたらOK
WEBP* WEBP rw- WebP Image Format (libwebp 0.4.3 [0203])
使えなかったら、アンインストールして新しいバージョンをインストール
・インストール
yum install epel-release
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6.rpm
yum install –enablerepo=remi ImageMagick7 ImageMagick7-devel
・再度使えるか確認
convert rose: rose.webp
identify rose.webp
↓こんな感じで返ってきたらOK
rose.webp WEBP 70×46 70×46+0+0 8-bit sRGB 906B 0.000u 0:00.000
・可逆圧縮で圧縮率を指定
convert image.jpg -quality 85 -define webp:lossless=true image.webp
Apache2でやったら、
Content-Type: audio/unknown
になった、、、
とりあえず、これを設定したら認識してくれた。
AddType image/webp .webp
・参考URL
https://github.com/vincentorback/WebP-images-with-htaccess
コメント