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

🐛 Fix image processing issue #374

Merged
merged 1 commit into from
Nov 7, 2024
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
9 changes: 6 additions & 3 deletions lib/iiif_print/image_tool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def convert_image(source, destination, monochrome)
monochrome &&= destination.slice(-4, 4).index('tif')
mono_opts = "-depth 1 -monochrome -compress Group4 -type bilevel "
opts = monochrome ? mono_opts : ''
cmd = "convert #{source} #{opts}#{destination}"
cmd = "convert #{source} #{opts}#{destination} && sync"
`#{cmd}`
end

Expand Down Expand Up @@ -74,8 +74,11 @@ def im_identify_geometry(lines)

# @return [Array<String>] lines of output from imagemagick `identify`
def im_identify
cmd = "identify -format 'Geometry: %G\nDepth: %[bit-depth]\nColorspace: %[colorspace]\nAlpha: %A\nMIME type: %m\n' #{path}"
`#{cmd}`.lines
cmd = "identify -limit memory 8GiB -limit map 16GiB -limit disk 50GiB -format 'Geometry: %G\nDepth: %[bit-depth]\nColorspace: %[colorspace]\nAlpha: %A\nMIME type: %m\n' #{path}"
output, status = Open3.capture2(cmd)
Rails.logger.info "Identify command output: #{output}"
Rails.logger.info "Identify command status: #{status}"
output.lines
end

def im_mime(lines)
Expand Down
Loading