Skip to content

Commit

Permalink
Merge pull request #374 from scientist-softserv/fix-image-processing
Browse files Browse the repository at this point in the history
🐛 Fix image processing issue
  • Loading branch information
Shana Moore authored Nov 7, 2024
2 parents 7f35ea9 + 28d5c7f commit 9c4783a
Showing 1 changed file with 6 additions and 3 deletions.
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

0 comments on commit 9c4783a

Please sign in to comment.