Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

15
LINES

< > BotCompany Repo | #1006059 - getImageFromClipboard

JavaX fragment (include)

import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.DataFlavor;

static BufferedImage getImageFromClipboard() ctex {
  Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
  if (t == null) null;
  
  L<File> l = cast getTransferData(t, DataFlavor.javaFileListFlavor);
  if (nempty(l))
    ret loadImage2(first(l));
  
  if (t.isDataFlavorSupported(DataFlavor.imageFlavor))
    ret (BufferedImage) t.getTransferData(DataFlavor.imageFlavor);
  ret imageFromDataURL(getTextFromClipboard());
}

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006059
Snippet name: getImageFromClipboard
Eternal ID of this version: #1006059/6
Text MD5: 491606d75a4daefb48ff650f551f23eb
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-07 16:48:38
Source code size: 555 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 462 / 462
Version history: 5 change(s)
Referenced in: [show references]