I am wondering if there is a way to create a web application that allows the user to attach a raster image file such as a jpg or jpeg and download a vector image with ImageGraphics. I have figured out everything except how to let the user download the output of ImageGraphics to their computer.
I have searched “Download” in the documentation center and I wondering if there is a way to create a button that will download the output file if they click on the button, similar to the function ClickToCopy. I do know that I can create a separate cloud expression link and then that will have a download button for make my own copy but I am wondering if there is a way for something such as ClickToDownload without redirecting.
Does Export do what you need?
I tried
CloudDeploy[
FormFunction[{"image" -> "Image"},
Export[File@"image.svg", ImageGraphics[#image], "SVG"] &]]
but I can’t get it to work.
I also tried CloudPut and Manipulate.
I tried this and it works.
Is there a way to make downloading the file optional?
I have made some changes but this code fails with the automatic download. Sometimes when I deploy the code to the cloud I have a white screen and there is no app.
CloudDeploy[
FormFunction[{"x" ->
Interpreter[Restricted["UploadedFile", "Image"]]},
ImageGraphics@Import[#x] &, "PNG"],
FileNameJoin[{$CloudRootDirectory, "vector image.svg"}],
Permissions -> "Public"]