Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make sure layers are flattened to fix pdf tripple issue #1988

Merged
merged 5 commits into from
Sep 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading