Skip to content

Commit 0c49358

Browse files
committed
alpha default now omits the -alpha option
1 parent 9932790 commit 0c49358

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

lib/grim.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module Grim
1818
COLORSPACE = "RGB"
1919

2020
#Default Alpha
21-
ALPHA = "Set"
21+
ALPHA = ""
2222

2323
# Default exception class for Grim.
2424
class Exception < ::StandardError

lib/grim/image_magick_processor.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def save(pdf, index, path, options)
2626
quality = options.fetch(:quality, Grim::QUALITY)
2727
colorspace = options.fetch(:colorspace, Grim::COLORSPACE)
2828
alpha = options.fetch(:alpha, Grim::ALPHA)
29-
command = [@imagemagick_path, "-resize", width.to_s, "-alpha", alpha, "-antialias", "-render",
29+
alpha = alpha == '' ? alpha : "-alpha #{alpha}"
30+
command = [@imagemagick_path, "-resize", width.to_s, alpha, "-antialias", "-render",
3031
"-quality", quality.to_s, "-colorspace", colorspace,
3132
"-interlace", "none", "-density", density.to_s,
3233
"#{Shellwords.shellescape(pdf.path)}[#{index}]", path]

spec/lib/grim_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
end
2828

2929
it "should have ALPHA constant set to 'Set'" do
30-
expect(Grim::ALPHA).to eq('Set')
30+
expect(Grim::ALPHA).to eq('')
3131
end
3232

3333
describe "#reap" do

0 commit comments

Comments
 (0)