rawles / edit.tf

An in-browser editor for teletext frames.
http://edit.tf/
GNU General Public License v3.0
92 stars 19 forks source link

Can’t save an image in Safari on a Mac #52

Closed hairydalek closed 7 years ago

hairydalek commented 7 years ago

I know this is likely a browser issue, but I understand you can convert the Canvas to a bitmap using JavaScript, so I’ll log the in the hope that it can be added in the future.

In Firefox, if I right click on the canvas, I get an option to save as an image. That option does not appear in Safari on a Mac (using Sierra).

dodginess commented 7 years ago

This is a browser issue, but it should be possible to implement this using the toDataURL() function and then opening a new browser window and loading the image as a data URI. This assumes that the developer wants to add this functionality of course :)

Using Firefox and Firebug I was able to open a PNG of the currently loaded frame in a new tab like this:

var canvas = document.getElementById('frame'); var snapshot = canvas.toDataURL('image/png'); window.open(snapshot, '_blank');

When I copy-and-paste the URL this code generates into Safari's address bar the image displays as expected, and the "Save Image As..." option is available when I Control-click on the image in Safari.

rawles commented 7 years ago

Hi! Thanks for this. As a newcomer to HTML5 Canvas stuff, I didn't know this was possible. I'm going to have a go at implementing it via the export menu and see if I can get it work.

rawles commented 7 years ago

Thanks for the explanation @dodginess. I used it to do a little fix whereby now you can do ESC-E (export) and get a new option of a PNG screenshot. It hides the status bar for you. It works in the version of Safari on my computer (9.0.2). Is this what you were after, @hairydalek?

hairydalek commented 7 years ago

I'm not able to test this right now, but that this sounds right to me.

rawles commented 7 years ago

It works on my version of Safari, so I'll close this.