quick_magick 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of quick_magick might be problematic. Click here for more details.
- data/Rakefile +1 -1
- data/lib/quick_magick/image.rb +24 -6
- data/quick_magick.gemspec +3 -3
- data/test/image_test.rb +6 -0
- metadata +3 -3
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('quick_magick', '0.6.
|
5
|
+
Echoe.new('quick_magick', '0.6.1') do |p|
|
6
6
|
p.description = "QuickMagick allows you to access ImageMagick command line functions using Ruby interface."
|
7
7
|
p.url = "http://quickmagick.rubyforge.org/"
|
8
8
|
p.author = "Ahmed ElDawy"
|
data/lib/quick_magick/image.rb
CHANGED
@@ -63,11 +63,19 @@ module QuickMagick
|
|
63
63
|
|
64
64
|
# returns info for an image using <code>identify</code> command
|
65
65
|
def identify(filename)
|
66
|
-
|
66
|
+
error_file = Tempfile.new('identify_error')
|
67
|
+
result = `identify #{filename} 2>'#{error_file.path}'`
|
67
68
|
unless $?.success?
|
68
|
-
|
69
|
+
error_message = <<-ERROR
|
70
|
+
Error executing command: identify #{filename}
|
71
|
+
Result is: #{result}
|
72
|
+
Error is: #{error_file.read}
|
73
|
+
ERROR
|
74
|
+
raise QuickMagick::QuickMagickError, error_message
|
69
75
|
end
|
70
76
|
result
|
77
|
+
ensure
|
78
|
+
error_file.close
|
71
79
|
end
|
72
80
|
|
73
81
|
end
|
@@ -299,7 +307,8 @@ module QuickMagick
|
|
299
307
|
# The polyline primitive requires three or more points to define their perimeters.
|
300
308
|
# A polyline is simply a polygon in which the final point is not stroked to the start point.
|
301
309
|
# When unfilled, this is a polygonal line. If the -stroke setting is none (the default), then a polyline is identical to a polygon.
|
302
|
-
# points - A single array with each pair forming a coordinate in the form (x, y).
|
310
|
+
# points - A single array with each pair forming a coordinate in the form (x, y).
|
311
|
+
# e.g. [0,0,100,100,100,0] will draw a polyline between points (0,0)-(100,100)-(100,0)
|
303
312
|
def draw_polyline(points, options={})
|
304
313
|
append_to_operators("draw", "#{options_to_str(options)} polyline #{points_to_str(points)}")
|
305
314
|
end
|
@@ -307,7 +316,8 @@ module QuickMagick
|
|
307
316
|
# The polygon primitive requires three or more points to define their perimeters.
|
308
317
|
# A polyline is simply a polygon in which the final point is not stroked to the start point.
|
309
318
|
# When unfilled, this is a polygonal line. If the -stroke setting is none (the default), then a polyline is identical to a polygon.
|
310
|
-
# points - A single array with each pair forming a coordinate in the form (x, y).
|
319
|
+
# points - A single array with each pair forming a coordinate in the form (x, y).
|
320
|
+
# e.g. [0,0,100,100,100,0] will draw a polygon between points (0,0)-(100,100)-(100,0)
|
311
321
|
def draw_polygon(points, options={})
|
312
322
|
append_to_operators("draw", "#{options_to_str(options)} polygon #{points_to_str(points)}")
|
313
323
|
end
|
@@ -353,7 +363,8 @@ module QuickMagick
|
|
353
363
|
|
354
364
|
# saves the current image to the given filename
|
355
365
|
def save(output_filename)
|
356
|
-
|
366
|
+
error_file = Tempfile.new('convert_error')
|
367
|
+
result = `convert #{command_line} '#{output_filename}' 2>'#{error_file.path}'`
|
357
368
|
if $?.success?
|
358
369
|
if @pseudo_image
|
359
370
|
# since it's been saved, convert it to normal image (not pseudo)
|
@@ -365,9 +376,12 @@ module QuickMagick
|
|
365
376
|
error_message = <<-ERROR
|
366
377
|
Error executing command: convert #{command_line} "#{output_filename}"
|
367
378
|
Result is: #{result}
|
379
|
+
Error is: #{error_file.read}
|
368
380
|
ERROR
|
369
381
|
raise QuickMagick::QuickMagickError, error_message
|
370
382
|
end
|
383
|
+
ensure
|
384
|
+
error_file.close
|
371
385
|
end
|
372
386
|
|
373
387
|
alias write save
|
@@ -376,7 +390,8 @@ module QuickMagick
|
|
376
390
|
# saves the current image overwriting the original image file
|
377
391
|
def save!
|
378
392
|
raise QuickMagick::QuickMagickError, "Cannot mogrify a pseudo image" if @pseudo_image
|
379
|
-
|
393
|
+
error_file = Tempfile.new('mogrify_error')
|
394
|
+
result = `mogrify #{command_line} 2>'#{error_file.path}'`
|
380
395
|
if $?.success?
|
381
396
|
# remove all operations to avoid duplicate operations
|
382
397
|
revert!
|
@@ -385,9 +400,12 @@ module QuickMagick
|
|
385
400
|
error_message = <<-ERRORMSG
|
386
401
|
Error executing command: mogrify #{command_line}
|
387
402
|
Result is: #{result}
|
403
|
+
Error is: #{error_file.read}
|
388
404
|
ERRORMSG
|
389
405
|
raise QuickMagick::QuickMagickError, error_message
|
390
406
|
end
|
407
|
+
ensure
|
408
|
+
error_file.close if error_file
|
391
409
|
end
|
392
410
|
|
393
411
|
alias write! save!
|
data/quick_magick.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{quick_magick}
|
5
|
-
s.version = "0.6.
|
5
|
+
s.version = "0.6.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Ahmed ElDawy"]
|
9
|
-
s.date = %q{2009-09-
|
9
|
+
s.date = %q{2009-09-24}
|
10
10
|
s.description = %q{QuickMagick allows you to access ImageMagick command line functions using Ruby interface.}
|
11
11
|
s.email = %q{ahmed.eldawy@badrit.com}
|
12
12
|
s.extra_rdoc_files = ["README", "lib/quick_magick/image.rb", "lib/quick_magick/image_list.rb", "lib/quick_magick.rb"]
|
13
13
|
s.files = ["README", "Rakefile", "lib/quick_magick/image.rb", "lib/quick_magick/image_list.rb", "lib/quick_magick.rb", "Manifest", "quick_magick.gemspec", "test/image_test.rb", "test/badfile.xxx", "test/multipage.tif", "test/image_list_test.rb", "test/test_magick.rb", "test/9.gif"]
|
14
14
|
s.homepage = %q{http://quickmagick.rubyforge.org/}
|
15
|
-
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Quick_magick", "--main", "README
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Quick_magick", "--main", "README"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = %q{quickmagick}
|
18
18
|
s.rubygems_version = %q{1.3.5}
|
data/test/image_test.rb
CHANGED
@@ -22,6 +22,12 @@ class ImageTest < Test::Unit::TestCase
|
|
22
22
|
assert_equal 1, i.size
|
23
23
|
end
|
24
24
|
|
25
|
+
def test_skip_warnings
|
26
|
+
filename = File.join($base_dir, "warnings.tiff")
|
27
|
+
i = QuickMagick::Image.read(filename)
|
28
|
+
assert_equal 1, i.size
|
29
|
+
end
|
30
|
+
|
25
31
|
def test_create_from_blob
|
26
32
|
blob = nil
|
27
33
|
File.open(@logo_filename, "rb") do |f|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quick_magick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ahmed ElDawy
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-24 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -49,7 +49,7 @@ rdoc_options:
|
|
49
49
|
- --title
|
50
50
|
- Quick_magick
|
51
51
|
- --main
|
52
|
-
- README
|
52
|
+
- README
|
53
53
|
require_paths:
|
54
54
|
- lib
|
55
55
|
required_ruby_version: !ruby/object:Gem::Requirement
|