因此,我正在开发我的第一个gdk_pixbuf_module。向webp模块添加动画。尽管在头文件和c文件中尝试了许多变体,但我仍然得到这些链接错误,我相信这些错误与gdk_pixbuf宏有关。我的猜测是我做了一些简单的错误,但我找不到它。感谢您的帮助。 这里是头文件io-webp-anim.h: //
// Created by alan on 2021-07-15.
//
#ifndef IO_WEBP_ANIM_H
#define IO_WEBP_ANIM_H
//#include <glib-object.h>
#include <webp/types.h>
所以我试着用webp的支持来编译图表.
我已经跑了
yum install libwebp libwebp-dev
我从libwebp.a添加了谷歌库。
并将--with-webp标志添加到./configure行。
我从以下几个方面取得了成功:
checking for WEBP support ...
checking webp/decode.h usability... no
checking webp/decode.h presence... no
checking for webp/decode.h... no
checking webp/encode.h usability...
所以我试图用--启用-libwebp编译ffmpeg。但我得到了以下错误:
In file included from libavcodec/libwebpenc_animencoder.c:30:0:
/usr/include/webp/mux.h:101:13: error: expected identifier or ‘(’ before ‘int’
WEBP_EXTERN(int) WebPGetMuxVersion(void);
^~~
/usr/include/webp/mux.h:107:13: error: expected identifier
我生成的*.webp文件与它们的png或jpg源代码完全相同。然后,我将这个添加到我的.htaccess中:
<IfModule mod_rewrite.c>
RewriteEngine On
# Does browser explicitly support webp?
RewriteCond %{HTTP_USER_AGENT} Chrome [OR]
# OR Is request from Page Speed
RewriteCond %{HTTP_USER_AGENT} "Google Page Speed Insights" [OR]
我已经找到一个脚本来转换一个目录中的文件,但我需要这与子目录
你能帮我吗?
#!/bin/bash
PATH=/usr/local/bin:/usr/bin:/bin
# cd to the directory of the image so we can work with just filenames
dir="$(dirname "$1")"
cd "$dir" || exit 1
base="$(basename "$1" .png)"
# create a WebP version of the P
不支持的颜色转换请求* WebP::EncoderError异常:无法读取输入图片文件在某些jpg文件上遇到此错误。虽然从google再次转换成jpg可以做到这一点,但是为什么会这样呢? ‘webp_path= "#{filename.ext}.webp“ # Encode (convert) image to webp format with passed options
WebP.encode(path, webp_path, options)
# HACK: Changing of this two instance variables is the only w
# Get .webpfile
for file in os.listdir(selected_folder):
if file.endswith(".webp"):
webp_path = os.path.join(selected_folder, file)
webp_name = os.path.join(file)
# Convert .webp to .jpg because YouTube do
我尝试过这两种方法,但仍然收到错误消息:“对不起,出于安全原因,不允许使用此文件类型。”
// add support for webp mime types
function webp_upload_mimes( $existing_mimes ) {
// add webp to the list of mime types
$existing_mimes['webp'] = 'image/webp';
// return the array back to the function with our added mime type
这是不能在本地运行的一小段htaccess,在chrome devtools中它显示状态未找到404,并键入text/html。 RewriteEngine On
RewriteBase /
# Does browser explicitly support webp?
RewriteCond %{HTTP_USER_AGENT} Chrome [OR]
# OR Is request from Page Speed
RewriteCond %{HTTP_USER_AGENT} "Google Page Speed Insights" [OR]
# OR does this