提高魔杖转换质量 [英] Improve quality of Wand conversion

查看:111
本文介绍了提高魔杖转换质量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用魔杖将不同格式的文件(JPEG,PNG,TIFF,PDF)转换为JPEG格式基于Python的ImageMagick绑定。生成的文件质量很差。如果原始文件中有文本,则在结果文件中几乎不可读。

I convert files of different formats (JPEG, PNG, TIFF, PDF) to JPEG using Wand, a ctypes-based ImageMagick binding for Python. The resulting files are very low-quality. If there is text in original file, it becomes almost unreadable in the resulting file.

在Wand之前我使用Imagemagick控制台命令,并使用选项 -density 我可以达到很好的质量。例如: convert -density 200 file.pdf file.jpg

Before Wand i used Imagemagick console commands, and with the option -density i could achieve great quality. For example: convert -density 200 file.pdf file.jpg.

什么是最惯用的改进方法Wand中生成的图像文件的图像质量?或者,至少,如何在Wand中设置密度选项?

What is the most idiomatic way to improve image quality of the resulting image file in Wand? Or, at least, how do i set the density option in Wand?

推荐答案

会对您有所帮助。将分辨率选项传递给 Image 的构造函数,例如:

This would help you. Pass resolution option to the constructor of Image e.g.:

with Image(filename='file.pdf', resolution=200) as image:
    image.compression_quality = 99
    image.save(filename='file.jpg')

这篇关于提高魔杖转换质量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆