Skip to main content

A tiny digital photographic utility.

Project description

Anshitsu

Testing

codecov

A tiny digital photographic utility.

"Anshitsu" means a darkroom in Japanese.

Install

Run this command in an environment where Python 3.10 or higher is installed.

We have tested it on Windows, Mac, and Ubuntu on GitHub Actions, but we have not tested it on Macs with Apple Silicon, so please use it at your own risk on Macs with Apple Silicon.

pip install anshitsu

Usage

It is as described in the following help.

INFO: Showing help with the command 'anshitsu -- --help'.

NAME
    anshitsu - Process Runnner for Command Line Interface

SYNOPSIS
    anshitsu PATH <flags>

DESCRIPTION
    This utility converts the colors of images such as photos.

    If you specify a directory path, it will convert
    the image files in the specified directory.
    If you specify a file path, it will convert the specified file.
    If you specify an option, the specified conversion will be performed.

    Tosaka mode is a mode that expresses the preference of
    Tosaka-senpai, a character in "Kyūkyoku Chōjin R",
    for "photos taken with Tri-X that look like they were
    burned onto No. 4 or No. 5 photographic paper".
    Only use floating-point numbers when using this mode;
    numbers around 2.4 will make it look right.

POSITIONAL ARGUMENTS
    PATH
        Type: str
        Directory or File Path

FLAGS
    --colorautoadjust=COLORAUTOADJUST
        Type: bool
        Default: False
        Use colorautoadjust algorithm. Defaults to False.
    --colorstretch=COLORSTRETCH
        Type: bool
        Default: False
        Use colorstretch algorithm. Defaults to False.
    --grayscale=GRAYSCALE
        Type: bool
        Default: False
        Convert to grayscale. Defaults to False.
    --invert=INVERT
        Type: bool
        Default: False
        Invert color. Defaults to False.
    --tosaka=TOSAKA
        Type: Optional[Optional]
        Default: None
        Use Tosaka mode. Defaults to None.
    --outputrgb=OUTPUTRGB
        Type: bool
        Default: False
        Outputs a monochrome image in RGB. Defaults to False.
    --noise=NOISE
        Type: Optional[Optional]
        Default: None
        Add Gaussian noise. Defaults to None.

NOTES
    You can also use flags syntax for POSITIONAL ARGUMENTS

If a directory is specified in the path, an out directory will be created in the specified directory, and the converted JPEG and PNG images will be stored in PNG format.

If you specify a JPEG or PNG image file as the path, an out directory will be created in the directory where the image is stored, and the converted image will be stored in PNG format.

Note: If you specify a file in any other format in the path, be aware there is no error handling. The program will terminate abnormally.

Algorithms

The following algorithms are available in this tool.

RGBA to RGB Convert

Converts an image that contains Alpha, such as RGBA, to image data that does not contain Alpha. Transparent areas will be filled with white.

This algorithm is performed on any image file.

invert

Inverts the colors of an image using Pillow's built-in algorithm.

In the case of negative film, color conversion that takes into account the film base color is not performed, but we plan to follow up with a feature to be developed in the future.

colorautoajust

We will use the "automatic color equalization" algorithm described in the following paper to apply color correction.

This process is more time consuming than the algorithm used in "colorstretch", but it can reproduce more natural colors.

(References)

A. Rizzi, C. Gatta and D. Marini, "A new algorithm for unsupervised global and local color correction.", Pattern Recognition Letters, vol. 24, no. 11, 2003.

colorstretch

The "gray world" and "stretch" algorithms described in the following paper are combined to apply color correction.

This process is faster than the algorithm used in "colorautoajust".

(References)

D. Nikitenko, M. Wirth and K. Trudel, "Applicability Of White-Balancing Algorithms to Restoring Faded Colour Slides: An Empirical Evaluation.", Journal of Multimedia, vol. 3, no. 5, 2008.

grayscale

Convert a color image to grayscale using the algorithm described in the following article.

Python でグレースケール(grayscale)化

Note: This article is written in Japanese.

Tosaka mode

Tosaka mode is a mode that expresses the preference of Tosaka-senpai, a character in "Kyūkyoku Chōjin R", for "photos taken with Tri-X that look like they were burned onto No. 4 or No. 5 photographic paper".

Only use floating-point numbers when using this mode; numbers around 2.4 will make it look right.

When this mode is specified, color images will also be converted to grayscale.

outputrgb

Outputs a monochrome image in RGB.

noise

Add Gaussian noise.

To add noise, you need to specify a floating-point number; a value of about 10.0 will be just right.

Special Thanks

We are using the following libraries.

shunsukeaihara/colorcorrect

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anshitsu-1.5.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anshitsu-1.5.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file anshitsu-1.5.0.tar.gz.

File metadata

  • Download URL: anshitsu-1.5.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.12.0 Linux/6.2.0-1015-azure

File hashes

Hashes for anshitsu-1.5.0.tar.gz
Algorithm Hash digest
SHA256 2db8e7f79ac73242e80197f4a39eb98f25093eb426987145fbc49a3eab833c6b
MD5 9238b689e141c6e1321f38535e9eb759
BLAKE2b-256 03f07714df962835e2f39e58c774beb9cbed28e8c093ca483165ab18ac631126

See more details on using hashes here.

File details

Details for the file anshitsu-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: anshitsu-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.12.0 Linux/6.2.0-1015-azure

File hashes

Hashes for anshitsu-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 544926d35202cb1450228918267c760bfc44bdc91cc2daf6551445ee3f3e89aa
MD5 b20ef09fa2bec02e47b7d6586026c506
BLAKE2b-256 61314aef7dc4c14faf746de196da330a8104525dd390be56b5da631eb85b7787

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page