<p>Let me see if I can provide a general, conceptual outline of what's going on in making an (individual) postage-stamp image.</p>
<ol>
<li>Decide what input astronomical images you will use. Since the input images will be single-filter &quot;grayscale&quot; images, the goal is to assign appropriate filters to the intended output R, G, and B channels of the postage-stamp RGB image. In this particular case, they are using KiDS <span class="math-container">$g$</span> images for the B channel and KiDS <span class="math-container">$r$</span> images for the R channel. Since they don't have an intermediate image for the G channel, they fake one by generating the mean of the <span class="math-container">$g$</span> and <span class="math-container">$r$</span> images (intermediate image <span class="math-container">$= (g + r)/2$</span>) and use that for the G channel. (Yes, it seems a bit odd that they're using the <span class="math-container">$g$</span> image for the B channel and not for the the G channel, but in this case they don't have anything closer to B channel.)[*]</li>
</ol>
<p>The input FITS images need to have the same pixel scale (e.g., how many arc seconds on the sky each pixel subtends, or maybe parsecs per pixel for an image of a galaxy from a simulation) and ideally need to be registered, so that each pixel in one individual image has the same sky coordinates as the corresponding pixel in the other images. This is almost certainly already true of the KiDS images they are using.</p>
<ol start="2">
<li><p>Start with a galaxy, where you know its right ascension and declination and also its size; this would presumably come from a catalog. (The size, in this particular case, is the Kron radius.)</p>
</li>
<li><p>Locate the relevant input astronomical images (e.g., the KiDS images containing the galaxy in question), which will almost always be in FITS format. Determine the coordinates of the pixel closest to the coordinates of the galaxy center. Define the appropriate box containing the galaxy center (e.g., some multiple of the galaxy size in pixels) and extract that subimage. Do this for each of the three input images. (In this particular case, an alternative approach is to extract the <span class="math-container">$g$</span> and <span class="math-container">$r$</span> subimages and then form the intermediate image by averaging those two.) Unless you're doing <em>everything</em> inside, e.g., a Python script that also does the final RGB image generation, you would then save the extracted images into separate FITS files.</p>
</li>
<li><p>At this point, you have three single-filter images corresponding to the RGB channels of your desired output image. There are various approaches one can use, including <a href="https://sites.soka.edu/suo/resources/create-true-color-image/" rel="noreferrer">loading the FITS images into SAOimage DS9</a>, <a href="https://github.com/weejerrick/astronomy/blob/master/Creating%20RGB%20Image/using_aplpy.ipynb" rel="noreferrer">loading and combining the images in Python</a>, converting the individual FITS images into grayscale formats that something like Photoshop can read, etc. You might take a look at <a href="https://noirlab.edu/public/products/fitsliberator/" rel="noreferrer">FITSLiberator</a>, which is an open-source GUI (and command-line) tool developed by astronomers for loading multiple FITS images and combining them into an RGB image you can save in TIFF format. (There are, I'm sure, software packages for amateur astronomers that do similar things.)</p>
</li>
</ol>
<p>[*] I see from looking at the KiDS DR4 page that there are <span class="math-container">$u$</span>-band (near-UV) images that could in principle have been used for the B channel; my guess would be that these are too noisy to be good for making nice color images.</p>

CC BY-SA 4.0
2023-11-30T13:13:47.627Z
2023-11-30T13:13:47.627Z
Peter Erwin
<p>If I understand your question right, by &quot;postage stamp&quot; you mean a small piece of the original survey image cropped to show each galaxy at a similar size, as in <a href="https://academic.oup.com/mnras/article/482/1/126/5116177#122958557" rel="nofollow noreferrer">Appendix C of the article you linked to</a>.  If so, a general outline of the answer would be that you need to:</p>
<ol>
<li>start with a very large high-resolution image of a section of the sky containing many galaxies (and hopefully few if any local stars or other foreground objects), such as the one produced by the Kilo-Degree Survey;</li>
<li>use a suitable clustering algorithm (such as the one described in the linked article) to find the centers of the galaxies in the large image and to estimate their radii;</li>
<li>for each galaxy found by the clustering algorithm, extract a square piece of the large image which is centered on the center of the galaxy and whose side length is proportional to the estimated radius of that galaxy;</li>
<li>scale all these square pieces of the image to the same size; and</li>
<li>tile them together into a grid.</li>
</ol>

CC BY-SA 4.0
2023-10-29T01:55:23.647Z
Thank you, I am looking at the Kilo-Degree Survey at https://kids.strw.leidenuniv.nl/DR4/index.php. It appears to me that the Kron radius is calculated based on the Serseic radius and the half-light radius. Is that what is used as the side length of the square?
user3236841
CC BY-SA 4.0
2023-11-30T12:19:09.360Z
@user3236841 The paper says, " The stamps enclose each galaxy to 2.5 times its Kron radius." So they are starting with the Kron radius (probably in arcsec, from a KiDS-based galaxy catalog), converting that to pixels using the pixel scale (arcsec/pix) of the KiDS images, and then extracting square images with sides $= 2.5 \times R_{\rm Kron}$. (Or possibly $5 \times R_{\rm Kron}$; it's a little ambiguous.)
Peter Erwin
CC BY-SA 4.0
2023-11-30T13:51:22.260Z
@PeterErwin: My understanding, from skimming the paper, was that they were actually _calculating_ (or rather estimating) the coordinates and the Kron radii of the galaxies from the image using their clustering algorithm, and using the "postage stamps" as a way to demonstrate the performance of their algorithm (since a bad algorithm might yield bad stamps where the galaxy could be off-center or incorrectly scaled or even not present at all, if the algorithm got confused enough). But of course the general process for making the stamps is still the same, just the data source differs.
Ilmari Karonen
CC BY-SA 4.0
2023-11-30T21:32:31.657Z
@IlmariKaronen Section 3 of that paper describes the data sources for their analysis, which are various catalogs produced by the GAMA project. They don't do any image analysis (which was done in various ways previously by GAMA to produce their catalogs). The "clustering algorithm"  works in the multidimensional parameter space of the catalogs (things like galaxy color, stellar mass, Sérsic index, star formation rate, etc.); it doesn't involve the images at all.
Peter Erwin
CC BY-SA 4.0
2023-11-30T21:33:22.520Z
The purpose of the postage-stamp images is just to provide visual examples of what the galaxies in the different parameter-space clusters look like.
Peter Erwin
CC BY-SA 4.0
2023-10-27T19:46:53.200Z
2023-10-27T19:46:53.200Z
Ilmari Karonen
<p>I am trying to follow the work in this paper, <a href="https://doi.org/10.1093/mnras/sty2690" rel="nofollow noreferrer">Reproducible k-means clustering in galaxy feature data from the GAMA survey</a>,  and I noticed that there are a few postage stamps of some galaxies. I am not familiar with how to go about making the postage stamps in Appendix C. What I am looking for is how to go about making these galaxy postage stamps (specifically, data and code). According to the paper, &quot;The three-colour stamps are made using r- and g-band imaging from the Kilo-Degree Survey (de Jong et al. 2013), and a mean of the two bands as the central colour channel. The stamps enclose each galaxy to 2.5 times its Kron radius.&quot;</p>
<p>I am trying to understand how one actually goes about making these postage stamp figures for any galaxy.</p>
<p>My question has to do with how to get to a postage stamp from the data that they have about the bands. How do they combine and how they are made? The question is not about tiling or creating a grid. What is the calculation that goes into making one postage stamp image?</p>

CC BY-SA 4.0
2023-10-26T22:28:27.837Z
To me their description seems pretty straightforward. They query a sky survey for data from a specific galaxy, probably using angular size values from a catalogue, then they combine bands, and combine the images together.
Topcode
CC BY-SA 4.0
2023-10-26T23:52:12.093Z
My apologies, @Topcode but how do they put these images together? That is the part I am confused about and have no experience with. Thanks very much again!
user3236841
CC BY-SA 4.0
2023-10-27T12:19:20.003Z
Do you mean "what software do they use for overlaying the bands to produce a colour image, and then tiling the images to create a grid of "postage stamps". Or "what criteria do they use for grouping the galaxies into two, three, four or five groups"
James K
CC BY-SA 4.0
2023-10-27T13:20:45.313Z
@JamesK thanks I am asking about the software and code that they used to make the postage stamps in Appendix C, from the paper, I see that they used k-means and they did not quite decide on the number of groups from what I can tell.
user3236841
CC BY-SA 4.0
2023-10-27T13:42:02.980Z
Why would this be an astronomical question? You can tile images with photoshop or imagemagick or any of a number of other tools.
James K
CC BY-SA 4.0
2023-10-27T16:13:28.733Z
I’m voting to close this question because it is not an astronomy question, but a question about image printing or design tools
Rory Alsop
CC BY-SA 4.0
2023-10-27T17:49:42.050Z
@JamesK, I know how use gimp or mtPaint or xfig or imagemagick or any number of other tools. My question has to do with how to get to a postage stamp from the data that they have about the bands. How do they combine and how they are made? The question is not about tiling or creating a grid. What is the calculation that goes into making one postage stamp image.
user3236841
CC BY-SA 4.0
2023-10-27T18:48:18.390Z
@RoryAlsop, this is not a question about image printing or design tools, but of getting from the astronomical data to a postage stamp.
user3236841
CC BY-SA 4.0
2023-10-28T20:03:45.193Z
That definitely sounds like an image design question then. Getting an image onto a postage stamp is nothing to do with astronomy.
Rory Alsop
CC BY-SA 4.0
2023-10-29T01:44:25.320Z
Sorry, @RoryAlsop, the question again is, how to get the different variables in the different bands to be transformed/converted to an intensity that can then be imaged, and for finding out if there is some software that does this first calculation before it can be displayed as an image.
user3236841
CC BY-SA 4.0
2023-11-30T12:16:36.480Z
@RoryAlsop I'd suggest that "how do you go from single-filter FITS images from an astronomical survey to a 3-channel color image" is at least *partly* astronomy-related. (Photoshop does not natively handle FITS images, nor does anything graphic-design-related understand Kron radii.) It's something astronomers (including myself) do.
Peter Erwin
CC BY-SA 4.0
2023-11-30T14:39:08.430Z
Thanks @PeterErwin - I think it was just the OP not describing what they wanted very well at all. James, Ilmari and I all seemed to read that it was purely an image design issue.
Rory Alsop
<galaxy>
how to make postage stamps of galaxies
user3236841
# how to make postage stamps of galaxies

(Asked by: username_0 on 2023-10-26)

I am trying to follow the work in this paper, [Reproducible k-means clustering in galaxy feature data from the GAMA survey](https://doi.org/10.1093/mnras/sty2690), and I noticed that there are a few postage stamps of some galaxies. I am not familiar with how to go about making the postage stamps in Appendix C. What I am looking for is how to go about making these galaxy postage stamps (specifically, data and code). According to the paper, "The three-colour stamps are made using r- and g-band imaging from the Kilo-Degree Survey (de Jong et al. 2013), and a mean of the two bands as the central colour channel. The stamps enclose each galaxy to 2.5 times its Kron radius."

I am trying to understand how one actually goes about making these postage stamp figures for any galaxy.

My question has to do with how to get to a postage stamp from the data that they have about the bands. How do they combine and how they are made? The question is not about tiling or creating a grid. What is the calculation that goes into making one postage stamp image?

**Tags:** galaxy

> **Comments:**
> **username_1**: To me their description seems pretty straightforward. They query a sky survey for data from a specific galaxy, probably using angular size values from a catalogue, then they combine bands, and combine the images together.  
> **username_0**: My apologies, @username_1 but how do they put these images together? That is the part I am confused about and have no experience with. Thanks very much again!  
> **username_2**: Do you mean "what software do they use for overlaying the bands to produce a colour image, and then tiling the images to create a grid of "postage stamps". Or "what criteria do they use for grouping the galaxies into two, three, four or five groups"  
> **username_0**: @username_2 thanks I am asking about the software and code that they used to make the postage stamps in Appendix C, from the paper, I see that they used k-means and they did not quite decide on the number of groups from what I can tell.  
> **username_2**: Why would this be an astronomical question? You can tile images with photoshop or imagemagick or any of a number of other tools.  
> **username_3**: I’m voting to close this question because it is not an astronomy question, but a question about image printing or design tools  
> **username_0**: @username_2, I know how use gimp or mtPaint or xfig or imagemagick or any number of other tools. My question has to do with how to get to a postage stamp from the data that they have about the bands. How do they combine and how they are made? The question is not about tiling or creating a grid. What is the calculation that goes into making one postage stamp image.  
> **username_0**: @username_3, this is not a question about image printing or design tools, but of getting from the astronomical data to a postage stamp.  
> **username_3**: That definitely sounds like an image design question then. Getting an image onto a postage stamp is nothing to do with astronomy.  
> **username_0**: Sorry, @username_3, the question again is, how to get the different variables in the different bands to be transformed/converted to an intensity that can then be imaged, and for finding out if there is some software that does this first calculation before it can be displayed as an image.  
> **username_4**: @username_3 I'd suggest that "how do you go from single-filter FITS images from an astronomical survey to a 3-channel color image" is at least *partly* astronomy-related. (Photoshop does not natively handle FITS images, nor does anything graphic-design-related understand Kron radii.) It's something astronomers (including myself) do.  
> **username_3**: Thanks @username_4 - I think it was just the OP not describing what they wanted very well at all. username_2, username_5 and I all seemed to read that it was purely an image design issue.  

---

## 2 answers

### Answer by username_4 on 2023-11-30. Score: 5

Let me see if I can provide a general, conceptual outline of what's going on in making an (individual) postage-stamp image.

1. Decide what input astronomical images you will use. Since the input images will be single-filter "grayscale" images, the goal is to assign appropriate filters to the intended output R, G, and B channels of the postage-stamp RGB image. In this particular case, they are using KiDS $g$ images for the B channel and KiDS $r$ images for the R channel. Since they don't have an intermediate image for the G channel, they fake one by generating the mean of the $g$ and $r$ images (intermediate image $= (g + r)/2$) and use that for the G channel. (Yes, it seems a bit odd that they're using the $g$ image for the B channel and not for the the G channel, but in this case they don't have anything closer to B channel.)[\*]

The input FITS images need to have the same pixel scale (e.g., how many arc seconds on the sky each pixel subtends, or maybe parsecs per pixel for an image of a galaxy from a simulation) and ideally need to be registered, so that each pixel in one individual image has the same sky coordinates as the corresponding pixel in the other images. This is almost certainly already true of the KiDS images they are using.

2. Start with a galaxy, where you know its right ascension and declination and also its size; this would presumably come from a catalog. (The size, in this particular case, is the Kron radius.)
3. Locate the relevant input astronomical images (e.g., the KiDS images containing the galaxy in question), which will almost always be in FITS format. Determine the coordinates of the pixel closest to the coordinates of the galaxy center. Define the appropriate box containing the galaxy center (e.g., some multiple of the galaxy size in pixels) and extract that subimage. Do this for each of the three input images. (In this particular case, an alternative approach is to extract the $g$ and $r$ subimages and then form the intermediate image by averaging those two.) Unless you're doing *everything* inside, e.g., a Python script that also does the final RGB image generation, you would then save the extracted images into separate FITS files.
4. At this point, you have three single-filter images corresponding to the RGB channels of your desired output image. There are various approaches one can use, including [loading the FITS images into SAOimage DS9](https://sites.soka.edu/suo/resources/create-true-color-image/), [loading and combining the images in Python](https://github.com/weejerrick/astronomy/blob/master/Creating%20RGB%20Image/using_aplpy.ipynb), converting the individual FITS images into grayscale formats that something like Photoshop can read, etc. You might take a look at [FITSLiberator](https://noirlab.edu/public/products/fitsliberator/), which is an open-source GUI (and command-line) tool developed by astronomers for loading multiple FITS images and combining them into an RGB image you can save in TIFF format. (There are, I'm sure, software packages for amateur astronomers that do similar things.)

[\*] I see from looking at the KiDS DR4 page that there are $u$-band (near-UV) images that could in principle have been used for the B channel; my guess would be that these are too noisy to be good for making nice color images.


---

### Answer by username_5 on 2023-10-27. Score: 3

If I understand your question right, by "postage stamp" you mean a small piece of the original survey image cropped to show each galaxy at a similar size, as in [Appendix C of the article you linked to](https://academic.oup.com/mnras/article/482/1/126/5116177#122958557). If so, a general outline of the answer would be that you need to:

1. start with a very large high-resolution image of a section of the sky containing many galaxies (and hopefully few if any local stars or other foreground objects), such as the one produced by the Kilo-Degree Survey;
2. use a suitable clustering algorithm (such as the one described in the linked article) to find the centers of the galaxies in the large image and to estimate their radii;
3. for each galaxy found by the clustering algorithm, extract a square piece of the large image which is centered on the center of the galaxy and whose side length is proportional to the estimated radius of that galaxy;
4. scale all these square pieces of the image to the same size; and
5. tile them together into a grid.

> **Comments:**
> **username_0**: Thank you, I am looking at the Kilo-Degree Survey at https://kids.strw.leidenuniv.nl/DR4/index.php. It appears to me that the Kron radius is calculated based on the Serseic radius and the half-light radius. Is that what is used as the side length of the square?  
> **username_4**: @username_0 The paper says, " The stamps enclose each galaxy to 2.5 times its Kron radius." So they are starting with the Kron radius (probably in arcsec, from a KiDS-based galaxy catalog), converting that to pixels using the pixel scale (arcsec/pix) of the KiDS images, and then extracting square images with sides $= 2.5 \times R_{\rm Kron}$. (Or possibly $5 \times R_{\rm Kron}$; it's a little ambiguous.)  
> **username_5**: @username_4: My understanding, from skimming the paper, was that they were actually _calculating_ (or rather estimating) the coordinates and the Kron radii of the galaxies from the image using their clustering algorithm, and using the "postage stamps" as a way to demonstrate the performance of their algorithm (since a bad algorithm might yield bad stamps where the galaxy could be off-center or incorrectly scaled or even not present at all, if the algorithm got confused enough). But of course the general process for making the stamps is still the same, just the data source differs.  
> **username_4**: @username_5 Section 3 of that paper describes the data sources for their analysis, which are various catalogs produced by the GAMA project. They don't do any image analysis (which was done in various ways previously by GAMA to produce their catalogs). The "clustering algorithm"  works in the multidimensional parameter space of the catalogs (things like galaxy color, stellar mass, Sérsic index, star formation rate, etc.); it doesn't involve the images at all.  
> **username_4**: The purpose of the postage-stamp images is just to provide visual examples of what the galaxies in the different parameter-space clusters look like.  

---

