This is one of the pending functionalities from Editor. Basically the user could export the map viewport to an image. There will be several options to be chosen like:
Of course the creation of the map image will need some time, that's the reason why we need a loading modal window. Similar to the export map functionality.
Design: https://github.com/CartoDB/design/issues/340
PR: https://github.com/CartoDB/cartodb/pull/11789
Note that the strict requirement is to export to PNG. If adding JPG is hard, we should wait to see if it makes sense to prioritise or not.
It is already implemented in the Maps API, so no difficulty added.
Also, https://carto.com/docs/carto-editor/maps#export-image.
One question regarding this ticket. Technically, for maps that use Google Maps basemaps we can generate an image that shows the geometries, but not the basemap below… should we want to inform users about this somehow in the UI?
cc @noguerol @saleiva @asimcox ^^^
but, for that case google maps has a static maps api so we could reach that api and merge frontend side
Bad news.
Yesterday I talked with @javierarce and @xavijam about how to solve this using existing static images from named maps (as we do for the dashboard previews). The named maps static images can use zoom, longitude, and latitude params.
However, that doesn't consider applied filters to the map and will export images with no filters applied, so we cannot rely on that functionality for exporting the images. We will need to use the current map instance to retrieve the adequate version (with filters applied) of the map in sight.
Ok, we'll need to use cdb.Image, but it seems it was removed some time ago (because it didn't work with cartodb.js v4?): https://github.com/CartoDB/cartodb.js/commit/2834c95959a09b1ad57500b6c0f4eff75ab6b1e3
cc: @alonsogarciapablo
After talking with @rochoa, @alonsogarciapablo & @xavijam last week, we decided to reenable, in the current v4 version of cartodb.js, the static image generation functionality that we previously had.
Initially, we won't be supporting the exact same API that cdb.Image had, just enough methods to generate an image from a visualization providing: a center (lat & lng) or a bounding box, a width and a height and the zoom level.
We also decided not to support static maps with basemaps with google maps at this moment, so the static maps in that particular case will only show geometries. @urbanphes and @noguerol: we should see if in that particular case we should show a message to our users.
So, considering the last comment, we probably have a problem regarding the current Google + image export use case we should attend, right @javisantana?
In other words, we need Google Maps support.
@alonsogarciapablo tells me that in the case of a private dataset, we'll need to use the API key. I imagine that we won't want to expose it in the UI (a user could accidentally pick the URL and paste it in a website).
What should we do in that case, @noguerol? Should we hide the URL when the map is private and only allow to download the image?
Also, we should take into account that the image URL will "expire" (i.e: not work) after some time. IMHO, we shouldn't expose it in the UI.
I agree, although don't know if the use case is to have a URL, download the image or both, @noguerol.
If it's just having an image, we could use the same solution as in the previous version of this feature: the URL that appeared was linked to the image object (see bottom of the page), so in the regular case it wasn't possible to grab the URL (only when using the advanced mode was possible to get it)

We should not expose the API key. We can enforce the image download via html, right?
@alonsogarciapablo will those temporal urls work without being logged in? Because in that case this could be a liability and we should think about a way to obscure the url.
We can enforce the image download via html, right?
Yes, see the attached picture in my previous comment.
@alonsogarciapablo will those temporal urls work without being logged in? Because in that case this could be a liability and we should think about a way to obscure the url.
Since we can't show the complete URL purely because of its size, we can truncate it and just show the first part that won't contain the API KEY. Or we could just use a text for the link instead of the URL.
@alonsogarciapablo will those temporal urls work without being logged in?
Yes, they are "public" URLs.
Here's a summary of the things we've talked offline between us:
Suggested feature flag: static-maps.
Problem to the url issue is we can not have users sharing images with third parties with an exposed api key. I propose we get rid of the final download modal window and we directly trigger download from the "export" button in the export pane.
cc @urbanphes
Ok, another change we've discussed offline with @noguerol & @urbanphes:
We have a button loading that we can use for this case.
When you update the map, this button has a loading icon inside the button.

cc/ @javierarce @noguerol
Oh, that's true, good catch 💋
Oh nice @javierarce what do you think
I think is time to implement it ;) I'll update the form with that kind of button.
:*
Chavales, this is looking good. Some things:
About point 2. that was second version if I don't recall wrong
- Maps with custom color basemaps only export geometries cc @alonsogarciapablo
@javierarce is going to update CartoDB.js cause it was a bit behind. Let's try again with latest changes.
@saleiva true, but we had to give support to that in order to support crop selection free movement, which is required, but this opens a UI conflict with crop areas out of the viewport bounds.
I don't get the dependency @noguerol. I'd just force the crop selection area to be inside the viewport.
Well, then I'm happy we have already developed it out of the scope, even if it was by accident, as it will be much of a need for corporate low res scenarios.
It is blocked until we don't have https://github.com/CartoDB/cartodb.js/pull/1598 merged in CARTO.js.
@noguerol apart from you, @urbanphes should also pass acceptance here :)
Ok, I didn't know but we have three dependencies:
Deploying frontend changes, but ticket will keep opened until we have all pieces in production 🤗 .
CARTO.js problem fixed and in production, thanks @alonsogarciapablo 💋 .
Maps API changes have been promoted to production 🎉 .
MÁQUINAS!