Pasting retina-images loses metadata. |
||||||
Issue descriptionhttps://bugs.chromium.org/p/chromium/issues/detail?id=355477#c53 """ This is still broken on Chrome on OSX testing, because the rewritten image doesn't have the PHYS block that we need to determine a retina from a non-retina screenshot. All images appear 4x bigger (2x on a side). That's great that we're now receiving all of the pixels, but bad that we have no idea how to interpret those pixels. 1. Run figma.com 2. Make a screenshot at 100% canvas and browser zoom. 3. Paste into the app. 4. Image appears 2x bigger on Chrome, correctly 1x size on Firefox. JPG also has a JIFF block for dpi, but we don't interpret that ye. ... ... Alternatively, disable PNG and JPG filtering just like Firefox did. The image and all of the pixels come through on Firefox, so that may be the better approach here. """ Also see my comment in https://bugs.chromium.org/p/chromium/issues/detail?id=355477#c32 "still broken" implies that there's a fixed goal that we were trying to reach and failed to reach. AFAICT, When I worked on this in August, there was a very defined [limited] behavior that we wanted to achieve, and I implemented that behavior. "disable PNG and JPG filtering just like Firefox did" What did Firefox do - do you have a link to a series of CLs or bugs? I don't know what you're referring to.
,
Mar 7 2017
,
Mar 7 2017
In my post that I linked above, I wrote: """ I think that the root of the problem lies with the clipboard API, which turns an image in the clipboard into a Blob, which loses metadata such as the desired display size of the image (e.g. is it retina). For example, in Firefox, there's no way to distinguish between a clipboard with a 200x200 non-retina image, and a 100x100 retina image. """ Without doing more research, I can't tell how Firefox is correctly interfacing with figma.com. Are you still using the clipboard API?
,
Mar 7 2017
,
Mar 7 2017
Yes, all using the clipboard api. In Firefox, the pasted image is the original PNG (default screenshot on OSX) when we receive it, and it still has the PHYS block set. From that, we extract the dpi. From Chrome, we get a PNG out but it's PHYS block is likely set to 72dpi. It's from re-encoding the source back to a PNG incorrectly.
,
Mar 7 2017
If you receive a PNG, then scrub it, but convert it back to a PNG with PHYS block and then pass that on. If you receive a JPG, then scrub it, and write it out to JPG with JIFF block. My assumption was that Firefox is not converting anything, and passing on the original data.
,
Mar 7 2017
I think it's probably fine not to scrub any data when passing it in from the OS, if it's natively supported. AFAIK, Windows doesn't really have any "native" clipboard formats for PNG, JPG etc, as there's no well-known registered format for it. However, OS X and Linux should be able to support those types of formats, and it would make pasting images much more efficient. It should be pretty straightforward to implement. garykac@, do you think it's worth waiting for navigator.clipboard to implement and expose this to the web?
,
Mar 9 2017
So I added dpi support to a pre-release of Figma to test out Chrome importing and passing through the PHYS block and it seems to for dropped in images. It's just the pasted screenshots that are filtered. Attached is a 2x = 144 dpi circle as a PNG.
,
Mar 9 2018
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Mar 15 2018
|
||||||
►
Sign in to add a comment |
||||||
Comment 1 by a...@figma.com
, Mar 6 2017