How do I create a Macro to run as a loop to convert avi files and save them as jpeg
I have many avi files need to be "process" as best focus image then save avi file as jpeg.
How do I create a macro that will allow me to do this automatically. Meaning, I just have to tell the macro where the avi file are located the macro will automatically convert the avi file after it have been process then save them as jpeg. Meaning each avi file after the process will generate one jpeg image.
Here is the general idea
step 1 load the avi file
step 2 run the process to generate the best focus image
step 3 save the image as jpeg.
I would like to put step 1, step 2 , step 3 into a loop because I have alot of avi files that need to go through step 1, step 2, step 3 repeatedly..
So far my macro only allow me to process one avi file at a time then I have to save the image manually, meaning I have to click on save and change the name of the image. How to do I do this AUTOMATICALLY? Going from avi to jpeg repeatedly similar to batch process all the avi file after it has been process as best focus image and save the focus image as jpeg.
Can anyone answer this question?
0
Best Answer
-
Hi Yuri,
Thanks. This actually works. Hope to see you answer more questions on the forum.
Next step of the process will be data collection.
Best Regard,
Bill
0
Answers
Here is my Macro, I am using Image Pro Plus ver. 7.0
When I ran the Macro A_flatten_GFAP_Jpeg ( )
I have to manually select each the avi files and save it as jpeg...
If you notice my For X 0 to xTime and Next X this will allow me to process step 1,step 2 ,step 3
then go back to step 1. But, I have to do this manually.
My questions is how do I make it so it can save AUTOMATICALLY as jpeg with the proper avi name
without me having to rename jpeg each time to make it match the avi file name.
in step 3
ret= IpWsSaveAs("I:\GFAP_Ts1converted video\AVI\N1758-10X-10001_original.jpg","jpg")
Sub A_flatten_GFAP_Jpeg ( )
Dim X As Integers
Dim xTime As Integer
xTime=100
For X =0 to xTime
ret = IpTemplateMode(1)
'step 1 allow me to select and load the avi files.
ret = IpWsLoad ("I:\GFAP_Ts1converted video\AVI\N1758-10X-10001_original.avi","avi")
'step 2 where I ran the Extended Depth of Field to Generate the best focus image
ret = IpEDFShow(1)
ret = IpEDFAdd(0)
ret = IpEDFNew(0)
ret = IpEDFSet(EDF_NORMALIZE,1,0)
ret = IpEDFSet(EDF_CRITERIA, EDF_MAX_LOCALCONTRAST,0)
ret = IpEDFSet(EDF_ORDER,EDF_BOTTOMUP, 0)
ret = IpEDFCreate(EDF_COMPOSITE)
ret = IpEDFShow(0)
'step 3 I have to manually click on SAVE then rename the image to match the avi file name.
'need help on how to save this jpg automatically without having to rename the image each time.
ret= IpWsSaveAs("I:\GFAP_Ts1converted video\AVI\N1758-10X-10001_original.jpg","jpg")
ret= IpAppCloseAll( )
Next X
End Sub
Can anyone answer this?
It is a bit too complicated.
I am able to run it after I rename the Batch_Process.ipm save it as Batch_Process1.bas from my macro I was able to run the Process Directory( ). But do not know where to place step 2 and most importantly step 3
After I changed the path in
If gDirStart ="" Then
gDirStart = "C:\" to "I:\GFAP_Ts1converted video\AVI\" because it contain my avi video files.
End If
Now the hard part..where do I place step 2?
ret = IpEDFShow(1)
ret = IpEDFAdd(0)
ret = IpEDFNew(0)
ret = IpEDFSet(EDF_NORMALIZE,1,0)
ret = IpEDFSet(EDF_CRITERIA, EDF_MAX_LOCALCONTRAST,0)
ret = IpEDFSet(EDF_ORDER,EDF_BOTTOMUP, 0)
ret = IpEDFCreate(EDF_COMPOSITE)
ret = IpEDFShow(0)
and then the last step3 the saving jpg name with correct avi name
Can you help me with this?
...