Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
16th June 2009, 22:09 | #5 | Link |
Moderator
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
|
It should be possible somehow. This example is done in C# (which i know nothing about): http://www.csharphelp.com/archives3/archive551.html So, at least you can make a plugin which converts the clipboard to a picture. Perhaps it's possible to access the data in AviSynth too??
Any takers before i will try it next week? some other links which could be useful: http://www.switchonthecode.com/tutor...-the-clipboard http://msdn.microsoft.com/en-us/library/ms752053.aspx Last edited by Wilbert; 16th June 2009 at 22:18. |
18th June 2009, 08:39 | #12 | Link |
AviSynth Enthusiast
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,267
|
If you're going to be doing this a lot, it seems like it'd more practical to save all your screenshots to files first (there are plenty of tools that will save to automatically numbered files) and the use ImageReader on the whole bunch of them.
|
28th September 2009, 20:50 | #13 | Link |
Registered User
Join Date: Mar 2007
Posts: 407
|
Open clipboard image inside Avisynth
JohannesL,
I like to do photo processing with Avisynth. Putting the concerned images into a series and use imageReader() is impractical since that would say I need to open all photos with the Avisynth GUI (I use AvsP). But I prefer to do most of the handling - like scanning through them, cut or do simple corrections - inside a program like XnView. This is much faster and tailored to the dimensions, colorspace, EXIF-handling ... of digital photographs in contrast to movies. Still, some of the photos require correction with filters that I only can find for Avisynth. I wrote a .VBS script for that purpose these days. Maybe you like it too. Prerequisites - of course, use Windows - install an .AVS editor like AvsP and assign the extension .avs to it. - install ImageMagick including the COM+ Object How To Use the Script To use it, drop a graphics file onto the script or a link to the script. In XnView, you can assign an Alt+number keyboard shortcut to it. Alternatively, copy an image to the clipboard and open the .VBS without a command line parameter. The .VBS script generates a tailored but generic .AVS script and opens it. Either the file that you gave to the .VBS script is used inside the ImageReader() command, or the .VBS script saved the clipboard with the help of ImageMagick to a temporal file and opens this temporal file. While you work with AvsP, the .VBS script waits in background. The .AVS script should contain the ImageWriter() command with the temporal name. When you close AvsP, the .VBS script puts this file into the clipboard with the help of ImageMagick again. Your workflow is (assuming you use XnView and have the sript on Alt+1): 1. Have any image open 2. press Alt+1 3. the generic .AVS sript opens 4. modify the .AVS script in AvsP by removing comments, changing parameters etc. but switch the preview on and accept that the .AVS script will be somewhat slow since it ImageWriter()'s all of your steps 5. close AvsP 6. press Ctrl+V ==> Now your original image is overwritten with the content that you processed inside AvsP. But the EXIF and IPTC data etc persist! Code:
'''''''''''''''''''''''''' ' declarations: '''''''''''''''''''''''''' Const myTemp= "C:\temp\" '''''''''''''''''''''''''' ' functions: '''''''''''''''''''''''''' function writeAVS(sourceline) set oFS = CreateObject("Scripting.FileSystemObject") set f = oFS.CreateTextFile(myTemp & "AvsP.avs", true) f.WriteLine(replace(sourceline, "'", chr(34))) f.WriteLine(replace("a=last", "'", chr(34))) f.WriteLine(replace("LanczosResize(a.width()-a.width()%4,a.height()-a.height()%4)", "'", chr(34))) f.WriteLine(replace("#ConvertToYV12().hdr(0.5)", "'", chr(34))) f.WriteLine(replace("ConvertToRGB32()", "'", chr(34))) f.WriteLine(replace("LanczosResize(a.width(),a.height())", "'", chr(34))) f.WriteLine(replace("MergeARGB(a, last, last, last)", "'", chr(34))) f.WriteLine(replace("ImageWriter('f:\temp\AvsP', Type='tif')", "'", chr(34))) f.close set oFS= nothing end function '''''''''''''''''''''''''' ' Start of script: '''''''''''''''''''''''''' set oSH = WScript.CreateObject("WScript.Shell") set oIM= CreateObject("ImageMagickObject.MagickImage.1") set args = Wscript.Arguments if args.Count > 0 then for i = 0 to args.count -1 arg=args(i) writeAVS("ImageSource('" & arg & "',0,0,25,pixel_type='rgb32')") oSH.Run myTemp & "AvsP.avs", 5, true msgs = oIM.Convert(myTemp & "AvsP000000.tif", "clipboard:") next else msgs = oIM.Convert("clipboard:", myTemp & "AvsP.tif") writeAVS("ImageSource('" & myTemp & "'AvsP.tif',0,0,25,pixel_type='rgb32')") oSH.Run myTemp & "AvsP.avs", 5, true msgs = oIM.Convert(myTemp & "AvsP000000.tif", "clipboard:") end if enjoy martin53 |
Thread Tools | Search this Thread |
Display Modes | |
|
|