惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Security Blog
Microsoft Security Blog
J
Java Code Geeks
GbyAI
GbyAI
aimingoo的专栏
aimingoo的专栏
L
LangChain Blog
I
InfoQ
D
Docker
F
Fortinet All Blogs
Y
Y Combinator Blog
Martin Fowler
Martin Fowler
月光博客
月光博客
B
Blog
Engineering at Meta
Engineering at Meta
T
Tailwind CSS Blog
罗磊的独立博客
博客园_首页
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog RSS Feed
IT之家
IT之家
V
V2EX

jdhao's digital space

Conversion between base64 and OpenCV or PIL Image 腾讯云对象存储博客图床开启 CDN 加速(不需要购买额外域名) Search and Replace in Multiple Files in Vim/Neovim Change Table Column Width in LaTeX Image or Table Side by Side in LaTeX LaTeX 并排显示图像或表格 Firenvim: Neovim inside Your Browser Content inside HTML tags missing in Latest Hugo? Creating Markdown Front Matter with Ultisnips Labelme JSON 标注格式转 voc XML 格式 Nifty Nvim Techniques That Make My Life Easier -- Series 6 macOS 下如何为视频制作字幕 Running Command Asynchronously inside Neovim Resolving Merge Conflict after Git Stash Pop Pylint: command not found? A Hands-on Experience with Neovim's Built-in LSP Support 互联网上常用缩略语集锦 File Backup in Neovim Converting PDF Pages to Images with Poppler Nifty Nvim Techniques That Make My Life Easier -- Series 5 Neovim Configuration for System-wide Use How to sort a list of tuple or list in Python -- lambda or itemgetter? Building A Vim Statusline from Scratch 人类第一颗原子弹爆炸始末 Distributed Training in PyTorch with Horovod Learning Expect Programming Essential Knowledge about SSH Nifty LaTeX Techniques -- Series 1 更改 Adsense 邮寄地址,重新寄送 PIN Mintty Tips and Configurations
How to Convert PDF to Images with Imagemagick
2019-11-20 · via jdhao's digital space

Previously, I have talked about how to convert PDF to images using pdftoppm here. In this post, I want to share how to accomplish this task with Imagemagick.

Imagemagick provides the convert tool that can be used to do various complicated image processing tasks.

Convert All Pages of PDF File to Images#

Use convert to convert PDF pages to images with the following command:

convert -density 150 presentation.pdf -quality 90 output-%3d.jpg

In the above command, we convert all the pages of the PDF files to images. -density is used to specify the DPI of the output images. For PDF files, it must be the first option since PDF files has no notion of DPI. This option must be used first so that convert know how to sample the PDF pages. -quality specify the quality for the generated images. %3d is used to specify the format for generated image names. The generated images will be named output-001.jpg, output-002.jpg ……

Convert Single Page of PDF File to Image#

To convert a single page of PDF to image, use the following command:

convert -density 150 presentation.pdf[0] -quality 90 test.jpg

The number inside the bracket is used to select a page. Note that the page index starts at 0 instead of 1.

To resize the converted image, you can supply the -resize option:

convert -density 150 presentation.pdf[0] -quality 90 -resize 50% test.jpg

Convert A Range of PDF Pages to Images#

You can also specify a range of pages with the following command:

# convert from page 0 to page 5
convert -density 150 presentation.pdf[0-5] -quality 90 test.jpg

References#