LoginSignup
5
4

More than 5 years have passed since last update.

GhostScriptでPDFの最初のページのみ画像(jpg,png)化する

Last updated at Posted at 2014-05-29

Ghostscriptのインストール

Ubuntu/debian
sudo apt-get install ghostscript
osx
$brew install  ghostscript

ページの指定方法

-dFirstPage= -dLastPage= で対象ページを指定する。

$gs  -dFirstPage=1 \
     -dLastPage=1 \
     -sDEVICE=jpeg \
     -o cover.jpg \
     iPhone101.pdf

Rubygemsのrghostを使うと

RGhost::Convert.new("./iPhone101.pdf").to :jpeg, :filename => "cover.jpg" 

imagemagicをつかうと

PDFをまるごと、メモリーにのせるのか、とても思い処理になる。Ghostscriptで行ったほうが早かった。

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4