Skip to content

Commit 14d9d85

Browse files
committed
Revert "added the possibility to use the -alpha option from imagemagick, and added tests for it"
This reverts commit 0cf31d5.
1 parent 8c43d5f commit 14d9d85

File tree

5 files changed

+1
-25
lines changed

5 files changed

+1
-25
lines changed

lib/grim.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ module Grim
1717
# Default colorspace
1818
COLORSPACE = "RGB"
1919

20-
# Default alpha
21-
ALPHA = "Set"
22-
2320
# Default exception class for Grim.
2421
class Exception < ::StandardError
2522
end

lib/grim/image_magick_processor.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ def count(path)
2121
end
2222

2323
def save(pdf, index, path, options)
24-
alpha = options.fetch(:alpha, Grim::ALPHA)
2524
width = options.fetch(:width, Grim::WIDTH)
2625
density = options.fetch(:density, Grim::DENSITY)
2726
quality = options.fetch(:quality, Grim::QUALITY)
2827
colorspace = options.fetch(:colorspace, Grim::COLORSPACE)
29-
command = [@imagemagick_path, "-resize", width.to_s, "-alpha", alpha, "-antialias", "-render",
28+
command = [@imagemagick_path, "-resize", width.to_s, "-antialias", "-render",
3029
"-quality", quality.to_s, "-colorspace", colorspace,
3130
"-interlace", "none", "-density", density.to_s,
3231
"#{Shellwords.shellescape(pdf.path)}[#{index}]", path]

spec/fixtures/remove_alpha.pdf

-31.7 KB
Binary file not shown.

spec/lib/grim/image_magick_processor_spec.rb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -95,22 +95,6 @@
9595
end
9696
end
9797

98-
describe "#save with alpha option" do
99-
before(:each) do
100-
@path1 = tmp_path("to_png_spec-1.png")
101-
@path2 = tmp_path("to_png_spec-2.png")
102-
@pdf = Grim::Pdf.new(fixture_path("remove_alpha.pdf"))
103-
end
104-
105-
it "should use alpha" do
106-
Grim::ImageMagickProcessor.new.save(@pdf, 0, @path1, {:alpha => 'Set'})
107-
Grim::ImageMagickProcessor.new.save(@pdf, 0, @path2, {:alpha => 'Remove'})
108-
109-
`convert #{@path1} -verbose info:`.include?("alpha: 8-bit").should be_true
110-
`convert #{@path2} -verbose info:`.include?("alpha: 1-bit").should be_true
111-
end
112-
end
113-
11498
describe "#save with colorspace option" do
11599
before(:each) do
116100
@path1 = tmp_path("to_png_spec-1.jpg")

spec/lib/grim_spec.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@
2626
Grim::COLORSPACE.should == 'RGB'
2727
end
2828

29-
it "should have ALPHA constant set to 'Set'" do
30-
Grim::ALPHA.should == 'Set'
31-
end
32-
3329
describe "#reap" do
3430
it "should return an instance of Grim::Pdf" do
3531
Grim.reap(fixture_path("smoker.pdf")).class.should == Grim::Pdf

0 commit comments

Comments
 (0)