janko/image_processing

imagemagick に加えて、libvips が使える ruby gem.

Provides higher-level image processing helpers that are commonly needed when handling image uploads.

Goal

The goal of this project is to have a single gem that contains all the helper methods needed to resize and process images.

processed = ImageProcessing::MiniMagick
  .convert("png")
  .resize_to_limit(400, 400)
  .call(image)

# OR

processed = ImageProcessing::MiniMagick
  .source(image) # declare source image
  .convert("png")
  .resize_to_limit(400, 400)
  .call

# OR

processed = ImageProcessing::MiniMagick
  .source(image)
  .convert("png")
  .resize_to_limit!(400, 400) # bang method

libvips/libvips

A fast image processing library with low memory needs.

C で書かれている image magick より高速なライブラリ。

WindowOrWorkerGlobalScope.btoa() - Web API | MDN

const encodedData = window.btoa('Hello, world'); // 文字列をエンコード
const decodedData = window.atob(encodedData); // 文字列をデコード

Go Atoi, Itoa

👆を観て思い出したのが Go のこんなコードであった。

q := strconv.Quote("Hello, 世界")
q := strconv.QuoteToASCII("Hello, 世界")

strconv · pkg.go.dev