2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CLIP STUDIO PAINTで書き出したPNGをPDFで出力する

Posted at

概要

CLIP STUDIO PAINTで書いた漫画をPDFで一括出力するには500円の課金が必要です
ここではたったワンコインを ケチって :mask:(ゴホゴホ) エンジニアらしく、コマンドラインから複数のPNGをPDFに書き出してみました。

PNGからアルファチャンネルを削除

漫画なので透過表現は使用していませんが、PNGにアルファチャンネルが含まれているので削除します。
透過表現がないので、単純なアルファチャンネルの削除でいけるような気がしましたが、
なぜか -background white-alpha deactivate, -flatten では次のPDFに変換する過程で「アルファチャンネルがあるからダメ」と怒られてしまいます

# PNGからアルファチャンネルを削除
for i (*.png) { convert $i \( +clone -alpha opaque -fill white -colorize 100% \) +swap -geometry +0+0 -compose Over -composite -alpha off _$i }

ref: https://qiita.com/iwiwi/items/fdec3466c4dea5818b3a
途方に暮れていたところ、上記の記事を参考にさせていただきました。

PNGをPDFに変換

以下のコマンドでPNGをPDFに一枚ずつ変換します。

# PNG -> PDF へ変換
$ for i (_*.png) { img2pdf $i -o $i.pdf }

複数のPDFをひとつのPDFに統合

# 複数PDFを統合
pdftk *.pdf cat output out.pdf

まとめ

日頃のメンテナ不足がたたり、img2pdfやpdftkを入れようするたびにエラーに見舞われ、
homebrew doctor を繰り返したり、ライブラリの再インストールを行ったり、リンクをつなぎ直したりなど最終的に数時間を要してしまったので、

さっさと500円払ったほうが楽だと思いました

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?