/
graphics_magick_example.rb
executable file
·44 lines (37 loc) · 1.35 KB
/
graphics_magick_example.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env ruby -rubygems
require 'restclient'
require 'json'
# This example demonstrates the GraphicsMagick action by taking in a list of
# five images, and producing annotated, blurred, and black and white versions
# of each image. See actions/graphics_magick.rb
RestClient.post('http://localhost:9173/jobs',
{:job => {
'action' => 'graphics_magick',
'inputs' => [
'http://www.sci-fi-o-rama.com/wp-content/uploads/2008/10/dan_mcpharlin_the_land_of_sleeping_things.jpg',
'http://www.sci-fi-o-rama.com/wp-content/uploads/2009/07/dan_mcpharlin_wired_spread01.jpg',
'http://www.sci-fi-o-rama.com/wp-content/uploads/2009/07/dan_mcpharlin_wired_spread03.jpg',
'http://www.sci-fi-o-rama.com/wp-content/uploads/2009/07/dan_mcpharlin_wired_spread02.jpg',
'http://www.sci-fi-o-rama.com/wp-content/uploads/2009/02/dan_mcpharlin_untitled.jpg'
],
'options' => {
'steps' => [{
'name' => 'annotated',
'command' => 'convert',
'options' => '-font helvetica -fill red -draw "font-size 35; text 75,75 CloudCrowd!"',
'extension' => 'jpg'
},{
'name' => 'blurred',
'command' => 'convert',
'options' => '-blur 10x5',
'extension' => 'png'
},{
'name' => 'bw',
'input' => 'blurred',
'command' => 'convert',
'options' => '-monochrome',
'extension' => 'jpg'
}]
}
}.to_json}
)