Skip to main content

Generate a star trail image automatically from a sequence of images

Project description

PyStarTrails

Photographers and astrophotographers can use this package to quickly and easily generate star-trail images from a sequence of images in order to create stunning images of the night sky.

The previous image-processing software I used was Adobe Photoshop, a powerful image-processing program that can be used for the generation of star trails. However, I experienced slow computer performance after uploading a star trail image sequence (more than 500 images) since my RAM became overloaded with images. I was forced to divide the 500 images into small batches. This process took a considerable amount of time.

Due to this, I have decided to develop a lightweight and fast python package that does not require the installation of any external programs. I hope that this package will be useful for all astrophotographers and photographers worldwide :)

Developed by Yassir LAIRGI ©2022.

Installation

The PyStarTrails package can be installed through pip:

pip install pystartrails

Usage

This package assumes that you have already a sequence of night sky images that you want to create a star-trail image based on. In order create your first star-trail image, specify :

from pystartrails import TrailsGenerator



trails_generator = TrailsGenerator(sequence_repository, generated_img_repository, generated_img_extension, generated_img_name)

star_trail_img = trails_generator.generate_trails()

Where:

  • sequence_repository (str) : the image sequence repository (please be sure that your images have the same shape).

  • generated_img_name (str) : the name of your generated image (star trailed image)

  • generated_img_extension (str) : the extension of your generated image (either "JPG", "JPEG" or "PNG")

  • generated_img_repository (str) : here you specify where you want to save your generated trailed image. By default, the generated image is stored in the sequence repository

generate_trails() method returns array in the same format as the input format and in the same time saves the generated image in the specified generated_img_repository.

Example

This example is structured structured in three parts:

  1. Prepare the folder of your night sky image sequence. This repository is actually the sequence_repository attribute of TrailsGenerator class.

alt text

  1. Choose the generated image extension and where you want to save it (otherwise, it will be stored by default in the sequence repository).

  2. Generate your star trail image. AND ENJOY :D.

from pystartrails import TrailsGenerator



# Initialize the TrailsGenerator class

trails_generator = TrailsGenerator(sequence_repository = "../data/raw/" , generated_img_extension = "JPG", generated_img_name = "trailed_img")



# Generate trails

star_trail_img = trails_generator.generate_trails()



"""

OUTPUT



100%|██████████| 10/10 [00:04<00:00,  2.17it/s]

"""

You could also show the generated img using matplotlib.

import matplotlib.pyplot as plt 



plt.imshow(star_trail_img)

plt.show()

alt text

Dependencies

The PyStarTrails package needs the following packages :

See Also

All my star trail images were generated using this package. You could check my Instagram account Yassir LAIRGI.

Contribution

Feel free to contact me via the Issues tab on GitHub if you would like to contribute or provide feedback.

License

Please note that the PyStarTrails package is distributed under the MIT License (MIT).

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

pystartrails-0.0.3.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

pystartrails-0.0.3-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file pystartrails-0.0.3.tar.gz.

File metadata

  • Download URL: pystartrails-0.0.3.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for pystartrails-0.0.3.tar.gz
Algorithm Hash digest
SHA256 8ffc81fc1c0d788cb1aa9722c1dd4473087ef018b82a375a23e360522592096a
MD5 3fbba3d43338c7f5b22903ba26609228
BLAKE2b-256 4777bac1214b3c24f21f1bdc47d8912a0428a01120c0dadd7372d6dd4ea3f909

See more details on using hashes here.

File details

Details for the file pystartrails-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: pystartrails-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for pystartrails-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 54f44b1a6035844a55210c989318471fddfeba27f469833fc4de36216b72a1f8
MD5 f58252b62f0762577b82d522ec8d53f7
BLAKE2b-256 b4b12288d476ea50eb7c896e0e44b29e293941e22945ccb935ebe6c4a40ea207

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