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.4.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.4-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pystartrails-0.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 29a24d01349eac6ed670eb5603e31004f92c1facaedd3c9e0b69c468e33bb076
MD5 690a19e8273f848bb07fe546c1c828e3
BLAKE2b-256 04659c1aab6d1f7556dda40e86b917b6c6b82f7e3f727e0a425afff3dc226fef

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pystartrails-0.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b1145c89953c32e2d4870647429c3c0759f32b5860399bfabb12b85546de2e93
MD5 4808eb526a164719bcdee2ea59c6796c
BLAKE2b-256 f2e9f43640142be0f0ac5e33d945bc1eaf217a9bc06922ff172381969f9f0b46

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