Project

ruby-webp

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
A gem providing a ruby interface to Google WebP Codec Encoder and Decoder.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme
README for ruby-webp
=====================

Ruby-webp is a gem providing a ruby interface to Google WebP Codec.

To install, type 'gem install ruby-webp'

Usage:

  require 'rubygems'
  require 'ruby-webp'

  # Encoder Example 1

  cwebp = WebP::Encoder.new
  
  cwebp.compression_factor = 70
  cwebp.input_file = "picture.png"
  cwebp.output_file = "picture.webp"
  cwebp.show_config
 => "cwebp -q 70 picture.png -o picture.webp"
  cwebp.encode

  # Encoder Example 2
  
  cwebp = WebP::Encoder.new
 
  cwebp.spatial_noise_shaping = 70
  cwebp.deblocking_filter = 50
  cwebp.strong_filtering = true
  cwebp.auto_filter = true
  cwebp.target_size = 60000
  cwebp.input_file = "picture.png"
  cwebp.output_file = "picture.webp"
  cwebp.show_config
 => "cwebp -sns 70 -f 50 -strong -af -size 60000 picture.png -o picture.webp"
  cwebp.encode

  # Decoder Example 1

  dwebp = WebP::Decoder.new
  dwebp.input_file = "picture.webp"
  dwebp.ouput_file = "output.png"
  dwebp.show_config
 => "dwebp picture.webp -o output.png"
  dwebp.decode
  
  # Decoder Example 2
  
  dwebp = WebP::Decoder.new
  dwebp.input_file = "picture.webp"
  dwebp.output_ppm = true
  dwebp.output_file = "output.ppm"
  dwebp.show_config
 => "dwebp picture.webp -ppm -o output.ppm"
  dwebp.decode