app/services/riiif/imagemagick_command_factory.rb in riiif-2.0.0.beta2 vs app/services/riiif/imagemagick_command_factory.rb in riiif-2.0.0
- old
+ new
@@ -42,30 +42,35 @@
def jpeg?
transformation.format == 'jpg'.freeze
end
+ def layer_spec
+ '[0]' if info.format =~ /pdf/i
+ end
+
def input
- " #{path}"
+ " #{path}#{layer_spec}"
end
# pipe the output to STDOUT
def output
" #{transformation.format}:-"
end
def crop
- directive = transformation.crop.to_imagemagick
+ directive = Crop.new(transformation.region, info).to_imagemagick
" -crop #{directive}" if directive
end
def size
- directive = transformation.size.to_imagemagick
+ directive = Resize.new(transformation.size, info).to_imagemagick
" -resize #{directive}" if directive
end
def rotation
- " -virtual-pixel white +distort srt #{transformation.rotation}" if transformation.rotation
+ return if transformation.rotation.zero?
+ " -virtual-pixel white +distort srt #{transformation.rotation}"
end
def quality
" -quality #{compression}" if use_compression?
end