le0pard / webp-ffi

Ruby wrapper for libwebp
https://leopard.in.ua/webp-ffi/
MIT License
114 stars 14 forks source link

Library is unable to encode image files to the Webp files #24

Open vishal-bacancy opened 1 month ago

vishal-bacancy commented 1 month ago

Hello,

Currently, I'm using this library to convert PNG/JPG files to webP files for better performance, it was working fine but suddenly, the library stopped working and it is raising the below exception

path has .png file and webp_path has .webp file

WebP::EncoderError: Cannot read input picture file

image

I tried to use cwebp input_file -o output_file command to convert it from the terminal and it is working fine, but My Rails app is unable to convert it to the webp file using this library

le0pard commented 1 month ago

This error came from this function https://github.com/le0pard/webp-ffi/blob/master/ext/webp_ffi/util.c#L68 - this mean of C code cannot open the file or cannot decode image to get width and height

vishal-bacancy commented 1 month ago

thank you @le0pard for this information. I tried giving full access to the file but still, it wasn't working as expected, perhaps there are some issues with the decoding.