1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

コマンドラインでPDFのファイルサイズを削減

Posted at

Macを使っているのでPagesで文書を書いてるのですが、iPhoneで撮影した写真を貼り付けてたらファイルサイズが大きくなってしまいました。

Pagesのファイルサイズを減らす機能も、プレビューのQuatzフィルタでも減りません...

個別に画質を下げるとか面倒くさすぎる...

ということでコマンドラインでファイルサイズを削減しました。

ImageMagickを使います。いつの間にかインストールされていました。淹れてない方はBrewでインストールしてください。

% magick --version
Version: ImageMagick 7.1.1-45 Q16-HDRI aarch64 22722 https://imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP
Delegates (built-in): bzlib fontconfig freetype gslib heic jng jp2 jpeg jxl lcms lqr ltdl lzma openexr png ps raw tiff webp xml zlib zstd
Compiler: clang (16.0.0)

コマンド

解像度は300dpiでもそこまで大きくなりませんでした。72dpiや96dpiだとファイルサイズは小さくなりますが、画質もかなり落ちますね。

magick -compress JPEG -quality 70 -density 300 input.pdf output.pdf

Pagesやプレビューで試行錯誤してましたが、最初からこっちで作業してたほうが楽でしたね...

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?