With JS, one can loop though the clipbard data items to check if the type of the item is an image, as follows:
...
var items = pasteEvent.clipboardData.items;
for (var i = 0; i < items.length; i++) {
if (items[i].type.indexOf("image") === -1) {
return false;
}
var blob = items[i].getAsFile();
...
But this only works when I copy the file from the system. Instead, using the "Copy screenshot to clipboard" functionality, it won't work.
The item type in that case is called "MULTIPLE".
Do you know if there is a way to get the image as blob if it's coming from "Copy screenshot to clipboard"?
Note that I am testing this on Manjaro Linux with the preinstalled screenshot app. I don't know if the screenshot lives in the clipboard in a different format using other OS or Apps.