Low quality when converting PDF to JPG

ⅰ亾dé卋堺 提交于 2019-12-06 00:24:07
Alex Avoyants

Assuming original_pdf is content of pdf file, e.g.:

original_pdf = File.open('from_file.pdf', 'rb').read

Then apply quality options in block of method from_blob instead of block of method write:

image = Magick::Image::from_blob(original_pdf) do
  self.format = 'PDF'
  self.quality = 100
  self.density = 144
end
image[0].format = 'JPG'
image[0].to_blob
image[0].write('to_file.jpg')

Look also quality options for Magick::ImageList.new method.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!