mars-photo-api icon indicating copy to clipboard operation
mars-photo-api copied to clipboard

Perseverance: Grab full resolution PNG images

Open samgrover opened this issue 4 years ago • 9 comments

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.

samgrover avatar Feb 23 '21 20:02 samgrover

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.

corincerami avatar Feb 23 '21 20:02 corincerami

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?

samgrover avatar Feb 23 '21 21:02 samgrover

Based on my experience with the other rover datasets, that seems very unlikely. They tend to be very structured.

corincerami avatar Feb 25 '21 05:02 corincerami

@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.

mtilda avatar Feb 25 '21 05:02 mtilda

@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.

corincerami avatar Feb 25 '21 05:02 corincerami

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.

samgrover avatar Feb 25 '21 17:02 samgrover

Sweet :) I will begin working on adding a photo size parameter to the API. @chrisccerami should I make a new issue for that?

mtilda avatar Feb 26 '21 00:02 mtilda

That's not necessary, you can just reference this issue in your PR. Thank you.

corincerami avatar Feb 26 '21 05:02 corincerami

In python Import requests Get url Open file to get content should be "true"

ken-2021 avatar Jul 18 '21 19:07 ken-2021