
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
httpthumbnailer-client
Advanced tools
Ruby client to httpthumbnailer image thumbnailing, editing and format conversion HTTP API server.
gem install httpthumbnailer-client
require 'httpthumbnailer-client'
# read original image data (may be any format supported by ImageMagick/GraphicsMagick installation on the server)
data = File.read('image_file.jpg')
# with API server listening on localhost port 3100
# see the API server documentation for available operations, formats and options
# generate single thumbnail from image data (single thumbnail API)
thumbnail = HTTPThumbnailerClient.new('http://localhost:3100').thumbnail(data, 'crop', 60, 30, 'jpeg')
thumbnail.mime_type # => 'image/jpeg'
thumbnail.width # => 60
thumbnail.height # => 30
thumbnail.data # => 60x30 thumbnail JPEG data String
# generate set of thumbnails from image data (multipart API)
thumbnails = HTTPThumbnailerClient.new('http://localhost:3100').thumbnail(data) do
thumbnail 'crop', 60, 30, 'jpeg'
thumbnail 'crop', 80, 80, 'png'
thumbnail 'pad', 40, 40, 'png'
end
thumbnails[0].mime_type # => 'image/jpeg'
thumbnails[0].width # => 60
thumbnails[0].height # => 30
thumbnails[0].data # => 60x30 thumbnail JPEG data String
thumbnails[1].mime_type # => 'image/png'
thumbnails[1].width # => 80
thumbnails[1].height # => 80
thumbnails[1].data # => 80x80 thumbnail PNG data String
thumbnails[2].mime_type # => 'image/png'
thumbnails[2].width # => 40
thumbnails[2].height # => 40
thumbnails[2].data # => 40x40 thumbnail PNG data String
thumbnails.input_mime_type # => 'image/jpeg' - detected input image format by API server (content based)
thumbnails.input_width # => 800 - detected input image width by API server (content based)
thumbnails.input_height # => 600 - detected input image height by API server (content based)
# just identify the image
id = HTTPThumbnailerClient.new('http://localhost:3100').identify(data)
id.mime_type # => 'image/jpeg'
id.width # => 800
id.height # => 600
# pass transaction ID header to thumbnailer
id = HTTPThumbnailerClient.new('http://localhost:3100').with_headers('XID' => '123').identify(data)
id.mime_type # => 'image/jpeg'
id.width # => 800
id.height # => 600
# generate single thumbnail from image data with additional edits
thumbnail = HTTPThumbnailerClient.new('http://localhost:3100').thumbnail(data, 'crop', 60, 30, 'jpeg') do
edit 'rotate', 90
edit 'pixelate', 0.3, 0.2, 0.4, 0.4
end
# generate set of thumbnails from image data with additional edits
thumbnails = HTTPThumbnailerClient.new('http://localhost:3100').thumbnail(data) do
thumbnail 'crop', 60, 30, 'jpeg' do
edit 'rotate', 90
end
thumbnail 'crop', 80, 80, 'png' do
edit 'rotate', 270
edit 'pixelate', 0.3, 0.2, 0.4, 0.4
end
thumbnail 'pad', 40, 40, 'png'
end
For more details see RSpec for single thumbnail API and multipart API. Note that when providing only one thumbnail specification using multipart API style the client will actually use single thumbnail API instead.
This gem provides httpthumbnailer-client
command line tool that can be used to thumbnail images via httpthumbnailer.
# start thumbnailing server (to stop: kill `cat httpthumbnailer.pid`)
httpthumbnailer
# identify image
cat image.jpg | httpthumbnailer-client
# thumbnail to standard output
cat image.jpg | httpthumbnailer-client -t crop,100,200,png > thumbnail.png
# generate multiple thumbnails
cat image.jpg | httpthumbnailer-client -t crop,100,200,jpeg,quality:100 -t pad,200,200,png thumbnail1.jpg thumbnail2.png
# generate thumbnail with edits
cat image.jpg | httpthumbnailer-client -t 'fit,280,280,png!pixelate,0.3,0.2,0.4,0.4!rectangle,0.04,0.8,0.92,0.17,color:blue' > thumbnail.png
Copyright (c) 2013 - 2015 Jakub Pastuszek. See LICENSE.txt for further details.
FAQs
Unknown package
We found that httpthumbnailer-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.