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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 16th June 2009, 19:58   #1  |  Link
JohannesL
AviSynth/x264 user
 
JohannesL's Avatar
 
Join Date: Jan 2009
Posts: 149
Load image from Windows clipboard

I want to press print screen, and load the image into Avisynth directly.
Is there a way?
__________________
archlinux
JohannesL is offline   Reply With Quote
Old 16th June 2009, 20:10   #2  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
What do you mean by "load the image into Avisynth directly"?
Guest is offline   Reply With Quote
Old 16th June 2009, 20:23   #3  |  Link
kemuri-_9
Compiling Encoder
 
kemuri-_9's Avatar
 
Join Date: Jan 2007
Posts: 1,348
guessing he means to be able to automatically generate a 1 frame video clip from the picture data loaded in the clipboard...

and to which my knowledge of avisynth features, the answer is 'no'
__________________
custom x264 builds & patches | F@H | My Specs
kemuri-_9 is offline   Reply With Quote
Old 16th June 2009, 21:21   #4  |  Link
shoopdabloop
Registered User
 
Join Date: Mar 2009
Posts: 166
paste in paint, save as bmp
ImageSource("xxxxxxx.bmp")
shoopdabloop is offline   Reply With Quote
Old 16th June 2009, 22:09   #5  |  Link
Wilbert
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.
Wilbert is offline   Reply With Quote
Old 16th June 2009, 22:10   #6  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
I want the OP to clarify the problem.
Guest is offline   Reply With Quote
Old 17th June 2009, 11:53   #7  |  Link
JohannesL
AviSynth/x264 user
 
JohannesL's Avatar
 
Join Date: Jan 2009
Posts: 149
Quote:
Originally Posted by kemuri-_9 View Post
guessing he means to be able to automatically generate a 1 frame video clip from the picture data loaded in the clipboard...
That's what I want.
__________________
archlinux
JohannesL is offline   Reply With Quote
Old 17th June 2009, 13:37   #8  |  Link
hanfrunz
Registered User
 
hanfrunz's Avatar
 
Join Date: Feb 2002
Location: Germany
Posts: 540
It should be easy to code a input plugin, that does that, but i'm curios for what reason do you want it? You can use tools like xnview/paint/photoshop to paste the clipboard and see the picture...
hanfrunz is offline   Reply With Quote
Old 17th June 2009, 13:53   #9  |  Link
JohannesL
AviSynth/x264 user
 
JohannesL's Avatar
 
Join Date: Jan 2009
Posts: 149
Convenience, since I will be doing this a lot.
__________________
archlinux
JohannesL is offline   Reply With Quote
Old 17th June 2009, 14:19   #10  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
What are you going to do with one-frame videos?
Guest is offline   Reply With Quote
Old 17th June 2009, 14:39   #11  |  Link
JohannesL
AviSynth/x264 user
 
JohannesL's Avatar
 
Join Date: Jan 2009
Posts: 149
Apply Avisynth processing and use ImageWriter.
__________________
archlinux
JohannesL is offline   Reply With Quote
Old 18th June 2009, 08:39   #12  |  Link
stickboy
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.
stickboy is offline   Reply With Quote
Old 28th September 2009, 20:50   #13  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 407
Open clipboard image inside Avisynth

Quote:
Originally Posted by JohannesL View Post
Convenience, since I will be doing this a lot.
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
... extend the writeAVS() function to what you usually need inside this kind of .AVS script and ...

enjoy

martin53
martin53 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:35.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.