Skip to content

Commit

Permalink
Merge pull request #1988 from samvera/blank_tif_bug
Browse files Browse the repository at this point in the history
make sure layers are flattened to fix pdf tripple issue
  • Loading branch information
kirkkwang authored Sep 22, 2023
2 parents 254d3a4 + b110a22 commit 68199fa
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lib/hydra/derivatives/processors/image_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# frozen_string_literal: true

# Fix PDF tripple issue

module Hydra
module Derivatives
module Processors
module ImageDecorator
protected

# When resizing images, it is necessary to flatten any layers, otherwise the background
# may be completely black. This happens especially with PDFs. See https://github.com/samvera/hydra-derivatives/issues/110
def create_resized_image
create_image do |xfrm|
if size
xfrm.combine_options do |i|
i.flatten
i.resize(size)
end
end
end
end
end
end
end
end

::Hydra::Derivatives::Processors::Image.prepend(Hydra::Derivatives::Processors::ImageDecorator)

0 comments on commit 68199fa

Please sign in to comment.