From: Georgios Kontaxis Date: Mon, 30 Mar 2026 18:25:11 +0000 (-0400) Subject: How to install and execute in a Python virtual environment X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=92561fb91c98153f42bf817844b477e8ea4de83d;p=horshack-dpreview-img2nef.git How to install and execute in a Python virtual environment --- diff --git a/HOWTO b/HOWTO new file mode 100644 index 0000000..50644f6 --- /dev/null +++ b/HOWTO @@ -0,0 +1,19 @@ +# Initialize virtual environment +# python3 -m venv .venv + +# Activate +source .venv/bin/activate + +# Confirm it's activated. (Expect ending with .venv/bin/python) +which python + +# Install dependencies (only if activation is confirmed) +pip install opencv-python +pip install pillow +pip install numpy + +# Execute +for i in `ls other/generate_rgb/*.jpg`; do python img2nef.py --src.hsl=1,1,1 --outputfilenamemethod=INPUTFILE --ifexists=OVERWRITE Z5II "$i"; done + +# Deactivate +deactivate diff --git a/other/generate_rgb/HOWTO b/other/generate_rgb/HOWTO new file mode 100644 index 0000000..6691e44 --- /dev/null +++ b/other/generate_rgb/HOWTO @@ -0,0 +1,17 @@ +# Initialize virtual environment +# python3 -m venv .venv + +# Activate +source .venv/bin/activate + +# Confirm it's activated. (Expect ending with .venv/bin/python) +which python + +# Install dependencies (only if activation is confirmed) +pip install pillow + +# Execute +python3 generate_rgb.py + +# Deactivate +deactivate diff --git a/other/generate_rgb/generate_rgb.py b/other/generate_rgb/generate_rgb.py new file mode 100644 index 0000000..a50c490 --- /dev/null +++ b/other/generate_rgb/generate_rgb.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 +from PIL import Image + +# Image size +width, height = 6064, 4040 + +# (R, G, B) +colors = { + "red": (255, 0, 0), + "green": (0, 255, 0), + "blue": (0, 0, 255), + "white": (255, 255, 255), + "black": (0, 0, 0) +} + +for color in colors.keys(): + # Create a new image + img = Image.new("RGB", (width, height), colors[color]) + # Save as JPG + img.save("{color}.jpg".format(color = color), "JPEG", dpi=(300, 300)) +