Skip to main content

English description follows Japanese.


概要

mood_img は、与えられた説明文にもっともマッチする画像を提示する Python ライブラリです。 プレゼン資料、スライド、動画などで適切な画像を探したいときに役立ちます。

特徴

  • 説明文から画像検索: 例:「毎朝朝食を急いで食べます」→ 朝食の写真を取得
  • ローカル画像から選定: ユーザー自身が指定した画像ディレクトリ内から選ばれます
  • 重複回避機能: 同じスクリプト実行中は、同じ画像が繰り返し選ばれにくくなっています
  • コマンドライン対応: Python スクリプトなしでも画像取得が可能です

使い方

1. 初期設定

画像ファイルが入っているディレクトリを指定します。これは最初に一度だけ必要です。

import mood_img

mood_img.set_imgdir("path/to/imgs")

2. 画像を取得する

任意の説明文に対応する画像のパスが返されます。

print(mood_img.get("私がタヌキで"))	# 例: ./imgs/tanuki01.png
print(mood_img.get("こちらがキツネです。"))	# 例: ./imgs/fox_surprised.jpg

3. コマンドラインから使用

mood_img "私がタヌキで" "こちらがキツネです。"

カレントディレクトリに 0.png, 1.jpg のような形式で画像が保存されます。

注意点

  • 画像ディレクトリの準備が必要: このライブラリはインターネット検索を行わないため、利用者自身が画像ファイルを用意する必要があります。
  • 画像の重複は完全には防げない: 可能な限り回避されますが、候補画像が足りない場合は重複することがあります。

Overview

mood_img is a Python library that helps you find the most fitting image based on a given description. It is especially useful when creating slides, presentations, or videos and you want an image that matches a specific mood or sentence.

Features

  • Text-to-image matching: Example: "I rush through breakfast every morning" → Image of a breakfast
  • Uses local image directory: Images are selected from a directory specified by the user
  • Avoids duplicate selections: Within a single script run, it tries not to return the same image multiple times
  • Command-line usage available: Can be used without writing any Python code

Usage

1. Initial Setup

You must first specify the image directory containing your image files.

import mood_img

mood_img.set_imgdir("path/to/imgs")

2. Retrieve images

Pass a description, and the path to the most relevant image will be returned.

print(mood_img.get("I am a tanuki"))	# Example: ./imgs/tanuki01.png
print(mood_img.get("This one is a fox."))	# Example: ./imgs/fox_surprised.jpg

3. Command-line usage

mood_img "I am a tanuki" "This one is a fox."

This will generate 0.png, 1.jpg, etc., in the current working directory.

Notes

  • You must prepare image files: This tool does not fetch images from the internet. You need to provide a local image dataset.
  • Duplicate images may still appear: While it tries to avoid showing the same image more than once, duplicates can occur if there are not enough available options.

Metadata

Release files for mood-img 0.0.4

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

Source distribution (sdist)

Source distribution for mood-img 0.0.4
File Size Uploaded Provenance
mood_img-0.0.4.tar.gz 5.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mood-img 0.0.4
File Interpreter ABI Platform
mood_img-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 11.2 kB

Release files / mood_img-0.0.4.tar.gz

Download URL mood_img-0.0.4.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9b4cd6980f7a19a0360e149bd8890b3a68b54343aa3a7e5bb73425ca1f8a030b
BLAKE2b-256 checksum
How to use checksums
3412ce6519f45f1e5238b64e7f7b1db85672a0fad971d7110df2c417bcb2e1bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.3

Release files / mood_img-0.0.4-py3-none-any.whl

Download URL mood_img-0.0.4-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d10dc43925a0a540fab950f9c06248b5d5a5949fbc49e9f06d3eb38c1da95d49
BLAKE2b-256 checksum
How to use checksums
478f8820ccf23ec6acabbfac44b9c0c19e25fd77354e1ee4a020f9c44b83cd33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.3

Security for mood-img 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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