0

Hopefully this question wont be asking for too much and can be understandable, but any help would be amazing. Currently I am doing [astronomy] research, and I am required to construct a webpage of quasar spectra to look like this...Sample of final product

This is to be done so by downloading each individual spectra from this source here...https://data.sdss.org/sas/dr13/eboss/spectro/redux/images/v5_9_0/v5_9_0/3590-55201/.

The problem is, I am struggling to find a way to download large quantities of png files all at once. For some reason, all the spectra on this link do not have their coordinates (Right ascension and declination) on the file name. Whereas the code provided to me as an example does.

In the situation that I have the png "00:14:53.206-09:12:17.70-4536-55857-0770.png" downloaded, it should be displayed. However as mentioned before, all the files I have viewed when trying to do this myself, do not list those. My page looks like direct code, no actual images. But it remains in code because it cannot pull forward those spectra since they are not downloaded, and I would prefer to have them assorted by their coordinates.

Downloading a FITS file which contains the quasar catalog was suggested to me. Presumably, the coords would in some way have to be appended to the png files downloaded. Apparently this is all supposed to be easy.

In summary: How do I download large quantities of png files, where they do not display their coordinates. I also need a method of renaming the image files to so that their file names correspond with the coordinates, and then print to a webpage.

Rachel Gallen
  • 27,943
  • 21
  • 72
  • 81
  • The links don't seem to work. This is super vague. – Horia Coman Aug 02 '17 at 20:10
  • Yes that is correct. It is hard not to be vague when I am limited to so many links. – l1ve4science Aug 02 '17 at 20:18
  • https://stackoverflow.com/questions/45202265/python-pulling-png-from-a-website-outputting-to-another/45203427?noredirect=1#comment77672622_45203427 – l1ve4science Aug 02 '17 at 20:20
  • I'm having a hard time understanding exactly what your trying to accomplish BUT to answer the question of how to download a large number of images, I would suggest using the FireFox plugin DownloadThemAll (https://addons.mozilla.org/en-US/firefox/addon/downthemall/) You can provide a text file of the urls of all the images you wish to download. – Lee Wise Aug 02 '17 at 20:20
  • Download large quantities of png files, where they do not display their ra and decs. Find a way to get their file names renamed with those ra and decs, then print to a webpage. – l1ve4science Aug 02 '17 at 20:21

1 Answers1

0

When displaying images on a website (regardless of where you sourced the images from, or the format - jpg/png etc), it is advisable that you COMPRESS your images. This is especially valid in cases where the images are big, and where there are a number of images on the page (pages like yours!). There are a few online image compressors like tinypng (where you can upload ~30 images at at time to compress, and it compresses both jpg and pngs) or pngcrush.

Compressing images this way will reduce the file size (greatly in some cases) but the image appears the same. This will very much improve the load time on your site.

When you download a file (any file, not just an image file, you can save it as anything you want (name-wise) so you can rename the files on download. You will need to upload all the [preferably compressed] images to a web server in order to display them on a webpage. If you don't know ANY webscripting, start with learning basic html (you won't need a lot for this project), but the best way to display the images would probably be to use a loop to loop through the image folder using either javascript or php

Rachel Gallen
  • 27,943
  • 21
  • 72
  • 81
  • see https://stackoverflow.com/questions/12884284/iterating-through-image-folder-using-javascript-and-adding-the-result-in-html for looping through image folder and displaying images in html (uses javascript).. You can style this output by using CSS – Rachel Gallen Aug 03 '17 at 00:31
  • https://stackoverflow.com/a/19587581/1675954 how to loop through a folder using python – Rachel Gallen Aug 03 '17 at 14:49
  • or you could probably adapt this question (https://stackoverflow.com/questions/16244332/iterate-through-multiple-files-and-append-text-from-html-using-beautiful-soup ) from for-text to for-images. Either.. – Rachel Gallen Aug 03 '17 at 14:55