Skip to main content

img2ppt

スライド画像(JPG/PNG)または PDF を PowerPoint(.pptx)に自動変換するツールです。
テキスト・図形・背景を自動認識し、16:9 スライドとして再構成します。

動作環境: Windows 11 専用 / Python 3.12 以上 / Google Chrome 必須(初回セットアップのみ)


インストール

pip install .

全依存ライブラリ(OpenCV / Pillow / python-pptx / pypdfium2 / locro 等)が一括インストールされます。

初回セットアップ(Chrome Screen AI コンポーネントの取得)

初回のみ、Google Chrome をインストールした状態で以下を実行してください。

:: Chrome の Screen AI コンポーネントをローカルにコピー(約 107MB)
locro download

保存先: %LOCALAPPDATA%\locro(例: C:\Users\<ユーザー名>\AppData\Local\locro

以降はオフラインで動作します。Chrome は引き続きインストール不要です。

インストール確認

img2ppt --help

使い方

基本

:: 画像ファイルを変換
img2ppt スライド.jpg -d 出力フォルダ

:: 複数ファイルをまとめて変換(1入力 = 1 PPTX を順次生成)
img2ppt a.png b.jpg c.pdf -d 出力フォルダ

:: クリップボードの画像を変換(引数なし)
img2ppt -d 出力フォルダ

:: PDF を変換(全ページ → 1 ファイルの PPTX)
img2ppt 資料.pdf -d 出力フォルダ

入力モード

モード 方法 説明
ファイル指定 img2ppt <パス> [<パス> ...] JPG / PNG / PDF を直接指定(複数可、1入力 = 1 PPTX)
クリップボード img2ppt(引数なし) 画像 or ファイルをコピーしてからそのまま実行。複数ファイルコピー時は全対応ファイルをファイル名昇順で順次処理
PDF 拡張子 .pdf のファイルを指定 全ページを 1 つの PPTX にまとめる

出力ファイル

-d で指定したディレクトリに以下が出力されます。

ファイル 説明
{stem}_{random8}.pptx 最終 PowerPoint(入力ファイル名の stem に実行ごとのランダム英数字8文字を付与)
{stem}.json 認識結果の構造化 JSON
{stem}_04_inpainted.png テキスト除去後の画像
{stem}_05_1_segment_filled.png セグメント検出結果(シルエット)
{stem}_05_2_mask_segment.png セグメントマスク画像
{stem}_06_1_content_inpainted.png コンテンツ除去後の画像
{stem}_06_2_mask_colorize.png カラー分割マスク
{stem}_06_3_colorized.png カラー分割結果

オプション一覧

基本オプション

オプション デフォルト 説明
-d, --output-dir test/ 出力ディレクトリ
-o, --output-json 自動 最終 JSON の出力パス(単一ページ時のみ有効)
-v, --verbose オフ 詳細ログを表示(省略時はプログレスバーのみ)
--max-width 1920 入力画像の最大幅px(超過時はアスペクト比維持でダウンスケール)
--max-height 1080 入力画像の最大高さpx(同上)
--clean-tmp オフ(=デフォルトで一時ディレクトリは保持) 処理後に一時ディレクトリを削除する
--tmp-dir システム一時領域 一時ディレクトリの作成場所を指定
--pdf-dpi 150 PDF ページ変換の解像度(DPI)

出力パス個別指定

オプション 説明
--output-inpaint Step4 テキスト除去画像の出力パス
--output-seg-filled Step5 シルエット画像の出力パス
--output-mask-seg Step5 マスク画像の出力パス

画像鮮明化(Step1)

低解像度・圧縮ノイズが多い画像の OCR 精度を上げるための前処理です。
PNG または長辺 1280px 以上の JPG は自動スキップされます。

オプション デフォルト 説明
--denoise-h 10 ノイズ除去強度(大きいほど強く除去、ぼけやすい)
--bilateral-d 9 エッジ保持フィルタの近傍径
--sigma-color 60.0 エッジ保持フィルタの色シグマ
--sigma-space 60.0 エッジ保持フィルタの空間シグマ
--unsharp-radius 2 輪郭強調の半径(px)
--unsharp-percent 200 輪郭強調の強度(%)
--unsharp-threshold 2 輪郭強調の閾値

テキスト除去(Step4)

オプション デフォルト 説明
--sample-offset 3 背景色サンプリング位置(bbox 端から何 px 外側か)
--fill-expand 2 テキスト除去の塗り範囲拡張量(px)

セグメント検出(Step5)

オプション デフォルト 説明
--sat-max 40 背景とみなす最大彩度(HSV-S、0〜255)
--val-min 200 背景とみなす最小輝度(HSV-V、0〜255)

OCR 品質フィルタ(Step2.5)

オプション デフォルト 説明
--ocr-min-height 8 bbox 最小高さ(px)。これ未満は除外
--ocr-threshold 0.85 confidence 閾値(0.0〜1.0)。これ未満の word を除外

PowerPoint 生成(Step7)

オプション デフォルト 説明
--bg-tolerance 20 図形の背景透過許容幅(RGB 各チャンネル ±n)

実行例

:: 高解像度 PDF を変換
img2ppt 資料.pdf -d C:\output --pdf-dpi 200

:: 詳細ログを表示(一時ディレクトリはデフォルトで保持される)
img2ppt スライド.jpg -d C:\output --verbose

:: クリップボード画像を変換してデスクトップに保存
img2ppt -d %USERPROFILE%\Desktop

:: OCR フィルタを緩めて誤除外を減らす
img2ppt スライド.jpg -d C:\output --ocr-threshold 0.35

うまくいかないときは

症状 試すこと
テキストが認識されない --ocr-threshold を下げる(例: 0.35
誤認識テキストが残る --ocr-threshold を上げる(例: 0.55
背景色で塗りつぶしがうまくいかない --sample-offset--fill-expand を調整する
図形の背景が透過しすぎる / されない --bg-tolerance を調整する(大きくすると透過が広がる)
低彩度アイコンが検出されない --sat-max を上げる(例: 50
処理の途中経過を確認したい --verbose を付けて実行する(一時ディレクトリはデフォルトで保持され、中間画像を確認できる)
文字が小さすぎる / 大きすぎる 通常は元画像に自動追従する。入力が極端な高解像度なら --max-width/--max-height を調整

パイプライン概要

ステップ モジュール 処理内容
Step1 clarify.py 画像鮮明化(ノイズ除去・輪郭強調)
Step2 ocr.py Chrome Screen AI でテキスト検出・認識(word 単位)
Step2.5 ocr_filter.py geometric / confidence スコアで低品質 word を除外
Step3 split.py OCR bbox の autofit(tight_fit)処理
Step4 inpaint.py テキスト領域を背景色で除去・修復
Step5 segment.py HSV 2値化 + 連結成分ラベリングでオブジェクト検出
Step6 colorize.py container を投影プロファイル法で矩形分割・内包正規化
Step7 pptx_gen.py JSON + 中間画像から PowerPoint スライドを生成

依存ライブラリ

ライブラリ ライセンス 用途
locro MIT Chrome Screen AI OCR(テキスト検出・認識)
opencv-python Apache 2.0 画像処理
Pillow HPND(MIT互換) 画像入出力
numpy BSD 配列処理
python-pptx MIT PowerPoint ファイル生成
pypdfium2 Apache 2.0 PDF → 画像変換

ライセンス

MIT License

Release files for img2ppt 2.9.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for img2ppt 2.9.10
File Size Uploaded
img2ppt-2.9.10.tar.gz 96.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for img2ppt 2.9.10
File Interpreter ABI Platform
img2ppt-2.9.10-py3-none-any.whl Python 3 none any Details

Total release size: 197.5 kB

Release files / img2ppt-2.9.10.tar.gz

Download URL img2ppt-2.9.10.tar.gz
Size 96.2 kB
Tags Source
SHA-256 checksum
How to use checksums
73e3629c30ed10eabf9698e627b2431cfce9036d148888fc699e15926ba10260
BLAKE2b-256 checksum
How to use checksums
c284a4de039d370eb8d9d76d0386a7fdacd33a4c22551fbe8d5111efed5d20f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / img2ppt-2.9.10-py3-none-any.whl

Download URL img2ppt-2.9.10-py3-none-any.whl
Size 101.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6b6f8f4de53b0d2a185d98a47fefa90efbb6c5aced0f37b3ee8dbe2f970adf7
BLAKE2b-256 checksum
How to use checksums
fccd6494848b04e01d8f1e5a4cc34edfa515437017cbcbf023bbc3470ffc2e17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

2.9.10 This release

2 release files

2.9.2

2 release files

2.9.1

2 release files

2.9.0

2 release files

2.3.0

2 release files

1.6.0

2 release files

1.5.1

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.0

2 release files

1.3.5

2 release files

1.3.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page