mars-photo-api
mars-photo-api copied to clipboard
Perseverance: Grab full resolution PNG images
The Perseverance team is releasing images in full resolution in PNG format. These URLs are included in the feed.
The recently added support for Perseverance grabs the URL for large
image (in JPG format). Please also grab the URL for full_res
image (in PNG format) for all photos where it is available.
If I was familiar with Ruby, I would totally submit a pull request.
Thank you for your consideration.
It seems like to get the full_res
URL, all that's needed is to remove the last section of it which adds the size constraint and change the file extension to png
. For example,
https://mars.nasa.gov/mars2020-raw-images/pub/ods/surface/sol/00004/ids/edr/browse/ncam/NLM_0004_0667310972_991ECM_N0010052AUT_04096_00_2LLJ01_1200.jpg
becomes
https://mars.nasa.gov/mars2020-raw-images/pub/ods/surface/sol/00004/ids/edr/browse/ncam/NLM_0004_0667310972_991ECM_N0010052AUT_04096_00_2LLJ01.png
Rather than storing and presenting multiple URLs in the API, perhaps you can manage this in your application.
That could work if that assumption on URL structure can hold for the lifetime of the rover. I'm not well versed with these data sets. In your experience, is the structure likely to change?
Based on my experience with the other rover datasets, that seems very unlikely. They tend to be very structured.
@chrisccerami is this a feature you are interested in adding? Or is there a reason you would not want to add it.
It seems like we could add this feature to the photos controller by checking for a size parameter (possible values: "small", "medium", "large" (default), "full_res").
We wouldn't need to store extra data. We would only need to create a function to mutate the URL to correspond with the selected size.
I am happy to spend some time working on this.
@mxkay if you want to give it a shot, I'd be open to it. If folks think that would be a useful feature I'm certainly not opposed to it.
I'm primarily interested in the lossless PNG file. I could work with the workaround suggested above, but a dedicated entry in the response would be wonderful.
Sweet :) I will begin working on adding a photo size parameter to the API. @chrisccerami should I make a new issue for that?
That's not necessary, you can just reference this issue in your PR. Thank you.
In python Import requests Get url Open file to get content should be "true"