Kozmosi Logo
Articles/PixInsight/From Pixels to Stars: The Power of the Combine Images Script

From Pixels to Stars: The Power of the Combine Images Script

Faisal Khan

Monday, October 23, 2023

The universe is vast, mysterious, and full of wonders that are often beyond our comprehension. As we gaze into the night sky, we're met with a tapestry of stars, galaxies, and nebulae, each with their own stories to tell.

Capturing these celestial wonders requires not just powerful telescopes but also sophisticated software tools to process the immense amount of data collected. In the world of astrophotography, PixInsight is a game-changer. In this guide, we'll delve deep into a powerful script built on the platform: the Combine Images Script. 

What is the Need for the Combine Images Script?

Imagine dedicating hours to observing the vast expanse of the universe, capturing the stunning beauty of the NGC 3324 Cosmic cliffs, only to later face the challenge of having multiple filter images, each corresponding to a distinct pixel channel.

This poses an intricate dilemma for astrophotographers: how do we meticulously merge these multiple images into a singular, coherent, and visually striking final image?

PixInsight does offer a channel combination tool, allowing the fusion of up to three pixel channels or color space components into an RGB color image. But what's the solution when you find yourself with more than three raw data images?

For instance, in the NGC 3324 Cosmic cliffs processing workflow course, six images signify six distinct pixel channels, each representing a different filter wavelength image. The hurdle then becomes how to merge them in accurate proportions to the three primary colors available to generate a compelling starting point for further processing.

For a comprehensive visualization of how the Combine Images Script operates in PixInsight, watch our detailed Video Masterclass for FREE.

A Deep Dive into the Combine Images Script's Key Features

The Combine Images Script was created and is distributed for FREE by a user on the PixInsight Forums called DCarr and provides several key features that make it an essential tool in the arsenal of any astrophotographer. Let's take a closer look at these features and how they can help enhance your images.

Intuitive Graphical User Interface (GUI)

The GUI presents you with various options and settings to choose from, allowing you to customize the image merging process according to your preferences.

Review Image Section: A space that behaves much like the PixInsight real-time preview window. The only catch? You'll need to manually trigger a recombine to see the changes.

Image Selection and Colorization Options: Here, you have the universe at your fingertips. Mix, match, and experiment with different images and colors to craft your masterpiece.

Customization at Its Finest

When it comes to combining images, astrophotographers often face a unique challenge: finding the right balance between preserving image fidelity and highlighting subtle details.

Flexible RGB Color Customization: Every celestial body is unique, and the script recognizes that. With the power to customize the RGB color for each filter, your image will be as unique as the celestial body it represents.

Hue Adjustment Sliders: Precision is key in astrophotography. With adjustable sliders, you can tweak the hues to perfection, ensuring your image is a true representation of the cosmos.

Palette Extravaganza

Palette extra-what? Let us explain. A common issue in astrophotography is color balance discrepancies between filters. The script's palette options mean your image will not only be aesthetically pleasing but also scientifically accurate.

A Universe of Palettes: The script comes with built in color palettes for the Hubble Space Telescope (HST), Canada France Hawaii Telescope (CFHT), Sloan Digital Sky Survey (SDSS) and the James Webb Space Telescope (JWST), the script boasts default palettes for various telescopes.

Personalized Palettes: Every astrophotographer has their unique touch. And with the option to set personal palettes, your image will truly be one of a kind.

Diagnostics – Behind the Scenes

For those curious souls who want to understand the magic behind the scenes, the script offers detailed logs of each step. From the combination process to color adjustments, you can track every minute change, ensuring you're always in the loop.

A Step By Step Guide To Using The Combine Images Script

1. Setting the Stage: Preparing Your Workspace

Preparing a workspace is like setting the stage for a performance.

Location, Location, Location!: After downloading the script, it's necessary to place it in the dedicated scripts folder for it to function correctly. For those unfamiliar with the location, referring to the Script Repository chapter from our A to Z of PixInsight Masterclass is advised.

Folder Breakdown:

Input Images Folder: This is the go-to place for your raw cosmic captures, which the script will automatically detect upon launching. This can save time if you want to process the same image multiple times.

Saved Colorized Images Folder: This is where the debug images are stored if you enable debugging while generating your combined images. 

Saved Combined Images Folder:
This is where your combined masterpieces are stored after the script has worked its magic.

Saved Diagnostics Folder: This is where the debug logs are stored if you enable debugging, this can be useful if you select the linear fit operation and need to make sure it completed correctly.

Saved Settings Folder: This folder is essential, when you configure the script exactly the way you like it you can save off the settings into this folder. You can then reload the settings at a future date saving you having to reconfigure everything from scratch.

System Data Folder: This is essentially the backstage, giving you insights into the intricacies of the script's operations.

2. Uploading Your Galactic Masterpieces

Uploading your galactic masterpieces is just like choosing actors for a play. You'll need to select the images you want to merge from the input folder, and voila!

Automated Detection: Just by placing your images in the 'input images' folder, the script will recognize them and prompt a confirmation.

Manual Uploading: For those who prefer a hands-on approach, the folder icon within the script offers a gateway to pick images directly from your device.

Workspace Integration: If your images are already opened in PixInsight, they can be effortlessly integrated via the dropdown within the script.

3. Crafting Your Cosmic Color Symphony

Think of this step as your own personal orchestra. With customizable palettes and color adjustments, you can create a truly unique celestial masterpiece.

Customization: After uploading, the script efficiently identifies the filter each image was taken with and automatically assigns it a default color. However, those who like to get creative have the liberty to experiment with the colors until they achieve their envisioned result.

Palette Options: For users who prefer pre-existing color templates, the script provides renowned palettes, including those from the Hubble Space Telescope (HST) and the James Webb Space Telescope (JWST).

4. The Finishing Touches: Review, Refine, and Revel

You know what they say, the devil is in the details. With each image combining steps complete, you can review and refine your masterpiece before saving it to your desired location.

Review Image Section: This section of the script offers a real-time preview of the combined image, ready for final touches.

Auto-stretch Review: Essential for those working with linear data, ensuring that the images don't appear too dark.

Linked RGB Channels: As discussed in the Screen Transfer Function chapter from the A to Z of PixInsight Masterclass, this feature provides the flexibility to stretch all color channels either collectively or individually.

Shadow Clipping: Using sigma units, this tool allows for precision in adjusting the intensity of the image's shadows.

Interactive Histogram: A tool that provides insights into pixel distribution and guides necessary adjustments.

Mid-Tone & Saturation Adjustments: Tweaking these ensures the vibrancy of the image, making celestial bodies stand out yet blend harmoniously.

Pre-processing Options: The script offers options like Black Point clip, ensuring the true essence of the universe is captured.

Combination: The final step where the celestial images come together using various methods, such as mean, median, sum, or max, to create a vivid representation of the universe.


The universe, with its vast expanse and mesmerizing beauty, offers a visual symphony that astrophotographers strive to capture and convey. However, the intricate process of combining multiple images, each revealing a unique facet of the cosmos, can be challenging. The Combine Images Script emerges as a beacon, guiding enthusiasts through this intricate journey, transforming raw captures into breathtaking celestial masterpieces.

The script's capabilities, from its intuitive GUI to its rich palette options, empower photographers to narrate the universe's tales authentically. Yet, this journey need not be solitary. With platforms like Kozmosi, astrophotographers can immerse themselves in a community of like-minded explorers and experts, sharing knowledge, techniques, and passion. As you embark on your astrophotographic endeavors, let PixInsight be the tool that refines your craft, and Kozmosi be the guide that illuminates your path.

References and Additional Resources

Many of the concepts in this article were inspired by the following resources and I would highly recommend you check them out!

Learn More

Expand your Astrophotography processing skills with Susie, the self-described "Angel Astronomer". Get the A to Z of PixInsight Masterclass membership and learn how to use PixInsight as a professional Astrophotographer.

Combine Images Script | A to Z of PixInsight | Kozmosi.io