Here are the application steps
You'll notice that in the saved file, the image comes fine, any non-black text appears fine but black text seems lost in the black background. Could not find a way to override the black background for the generated image. Some example code below.
BufferedImage image = null;
try {
image = (BufferedImage) transferable.getTransferData(DataFlavor.imageFlavor);
} catch (UnsupportedFlavorException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
saveImageToDisk(image);
private void saveImageToDisk(BufferedImage image) {
File outputFile = new File("c:\\image.png");
try {
ImageIO.write(image, "png", outputFile);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Found the solution - it is to use a custom system flavour which understands the mimetype of 'image\\x-emf'. strip first 8 bytes and write the remaining content as Bufferred image
Found the solution - it is to use a custom system flavour which understands the mimetype of 'image\\x-emf'. strip first 8 bytes and write the remaining content as Bufferred image
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.