Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Chrome convert the image data to "image/png" mime-type when paste?

When I copy and paste a JPG image file into chrome. When I analyze the data from the Event.originalEvent.clipboardData, I only get image/png. Why?

OS : windows 7

I think it's not possible that it is converted when copied to clipboard. I try to paste it on other App. It can be saved as JPG.

I downloaded it from web page.

like image 661
Ziyu Zhou Avatar asked Dec 29 '15 10:12

Ziyu Zhou


People also ask

How do I paste an image into Chrome?

You can take a screenshot of the computer screen, then press Ctrl + V to paste your image into our clipboard extension.

How do I save Chrome as JPEG?

Saving WebP files as PNG or JPG in Chrome After locating it, right-click on the image and hover over 'Save image as Type' towards the bottom of the menu. A side menu will then appear giving the option to save either as a PNG or as a JPG. The next bit is completely up to you.


1 Answers

That said, it's obviously a goal to have as rich interaction as possible between native apps and websites. But the browser needs to do some "filtering" to expose only the data it knows a MIME type description for - MIME types is how we describe content on the web, it's cross-platform and hence more usable than com.apple.iWork.* strings. Also, the application might expose structured data for example in some XML format as one of the alternate parts on the clipboard.

This should pass through the clipboard api and show up as text/plain or image/jpeg+xml that we can interpret. paste works since it creates a blob object that has the correct svg extension, but clipboard paste never receives the data and only receives an alternate image/png item.

like image 133
Rishabh Kushwaha Avatar answered Oct 12 '22 19:10

Rishabh Kushwaha