金子邦彦研究室プログラミングLinux に関する話題Ruby で ImageScience を使ってサムネイル画像を作る

Ruby で ImageScience を使ってサムネイル画像を作る

URL: https://github.com/seattlerb/image_science

前準備

UbuntuUbuntu で OS のシステム更新を行うときは, 次のコマンドを実行.

UbuntuUbuntu のインストールは別ページ »で説明

sudo apt -y update
sudo apt -yV upgrade
sudo /sbin/shutdown -r now

CinePaint のインストール手順

sudo apt -y update
sudo apt -y install rubygems 
sudo apt -y install libimage-science-ruby
 

ImageScience を使ってみる

ImageScience を使ってサムネイル画像を作る Ruby プログラム例

irb1.8
require "rubygems"
require "image_science" 

ImageScience.with_image("/tmp/fruits.jpg") do |img|
  img.cropped_thumbnail(100) do |thumb|
    thumb.save "/tmp/a.jpg"
   end
end
exit