How to copy image, get path back when pasting in file input?
Solution 1:
Okay guys, This is what I did.
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace ClipSave
{
class Program
{
[STAThread] public static void Main()
{
if (Clipboard.GetDataObject() != null)
{
IDataObject data = Clipboard.GetDataObject();
if (data.GetDataPresent(DataFormats.Bitmap))
{
Image image = (Image)data.GetData(DataFormats.Bitmap, true);
string file = System.Windows.Forms.Application.CommonAppDataPath + "\\ClipSaveImage.png";
image.Save(file, System.Drawing.Imaging.ImageFormat.Png);
Clipboard.SetText(file);
}
else
MessageBox.Show("Copy valid image first");
}
else
MessageBox.Show("Copy image first");
}
}
}
Compiled it to an EXE, added a start-up menu shortcut to it with a hotkey Ctrl+Shift+C. It then copies the current image in clipboard to a file and puts path to the file into the clipboard.
Solution 2:
This AutoHotKey thread has an AutoHotKey script for taking a screenshot. It includes the source for a trivial .Net 1.1 program to save the clipboard to a PNG. You would want it to have a few other modifications:
- Save the image to a different folder, with a name better than
image.png
- Copy the path to the new image to your clipboard
The AutoHotKey Clipboard commands are another way to access that data, though a program to get its image data would be a bit more complicated.
Solution 3:
Not sure if i answering your question. but you can try out clipman. it helps you to copy everything and keep it aside until you select it back one by one. Clipman,source CNET