Batch processor via Script?

Started by sinus, June 02, 2014, 12:06:22 AM

Previous topic - Next topic

sinus

Hi folks
Official IM5 is near!  ;D

But I have a small question, I have no clue, is this possible or not:

Is it possible to call a Batch-processor via scripting and if yes, how?

The mail-tool from IM5 does allow us to choose a batch processor - preset, hence it came into my mind, if this would be also possible via scripting, this would be very cool.

If not ... then not!  8)
Best wishes from Switzerland! :-)
Markus

JohnZeman

I've never had a reason to try it, but it appears to me you can duplicate many batch processor procedures using a script.  In help see the The IMImage Class section.

Mario

Quote from: JohnZeman on June 02, 2014, 12:45:33 AM
I've never had a reason to try it, but it appears to me you can duplicate many batch processor procedures using a script.  In help see the The IMImage Class section.
Exactly. The IMImage class provides all the methods usually need to duplicate the batch processor operations.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Ferdinand

It probably isn't what you want, but there is my Photoshop processor script.  It uses Photoshop rather than the batch processor to do batch processing.
https://www.photools.com/community/index.php?topic=416.0

[I wrote this many years ago to overcome some limitations of the 3.6 batch processor, especially colour profile conversions.  There isn't the same need for it in 5.0, but it still suits my workflow so I migrated it and use it.]

sinus

#4
Quote from: Mario on June 02, 2014, 07:27:02 AM
Quote from: JohnZeman on June 02, 2014, 12:45:33 AM
I've never had a reason to try it, but it appears to me you can duplicate many batch processor procedures using a script.  In help see the The IMImage Class section.
Exactly. The IMImage class provides all the methods usually need to duplicate the batch processor operations.

Hi John and Mario
Thanks for your answers.
Yes, I knew this, I do use these IMImage-classes like autocontrast, borders, sharpen and so on. But it is of course not so convenient and expanded like the Batch processor.
Things like canvas, Border and shadows, effects and so on it is possible by scripting, I am sure, but with  a lot of more work.

I came simply on the idea, because I have seen in the email, that I can simply choose a batch processor preset and ... voila!
Hence I thought, I can simply choose inside a script a batch processor, let it run and turn back to the script.
Would have been nice  :D and convenient  8) and without a lot of work (because Mario did this work already in the Batch processor)  ;D ...

but does't matter, it what simply a question. :)

BTW: as you can see this fraction in my script, I have even played with this class ;)
image.AdjustBrightness(10)

'image.AdjustGamma(2)
'image.AdjustHSV(+10,+10,+12)
'image.AdjustHSV 0,10,0 ' gemaess Mario popt dies ein bild auf

'image.AdjustRGB(-7,-5,+5)
'image.ApplyICCProfile ' ???
'image.AutoContrast(0.005) 'Mario says, is the default, allerdings geben mir andere eingaben keine anderen Ergebnisse
'image.ConvertTosRGB
'image.Copy '???
'image.CopyAlphaChannel '???
'image.CopyRect '???
'image.Create '???
'image.ExifSetDPI ??????
'image.Fill(153) ' fuellt einfach das Bild mit einer Farbe
'image.FillAlphaChannel (155) ' fuellt das Bild "grau", resp. schleierhaft, aber dunkel
'image.Flip 'dreht das bild nach oben
'image.GaussianBlur(7) ' macht das bild ziemlich unscharf
'image.Invert
'image.InvertAlphaChannel
'image.Mirror
'image.NoiseRemoval(1.2) 'mit 10 hatte ich einen absturz - update: vielleicht nicht, ev. dauerte es einfach sehr lange, so wie bei removescrtches aus bei wert 10
'image.PasteFromClipboard ' koennte interessant sein, hm, bringt aber einfach das clipboard ueber das bild
'image.QRCode(f.Name,0,0) ' Probleme, wenn die Zahlen anders als 0
'image.RemoveScratches(0.5)
'image.RenderMarkup(.....) 'siehe im script selbst
'image.RenderText(...) 'wohl auch im script?
'image.Resize(1280,1280,imrmCubic,True)
'image.ResizePercent(50,imrmCubic)
'image.Rotate(30,True)
'image.Rotate(30,False)
'image.StripMetadata ' ev. auch interessant
'image.Tint(55,90) 'hatte keinen effekt
'image.UnsharpMask(1.2,70,40)
Best wishes from Switzerland! :-)
Markus

sinus

Quote from: Ferdinand on June 02, 2014, 09:02:02 AM
It probably isn't what you want, but there is my Photoshop processor script.  It uses Photoshop rather than the batch processor to do batch processing.
https://www.photools.com/community/index.php?topic=416.0

[I wrote this many years ago to overcome some limitations of the 3.6 batch processor, especially colour profile conversions.  There isn't the same need for it in 5.0, but it still suits my workflow so I migrated it and use it.]

Hi Ferdinand
Maybe your script, what I have overlooked, could be a solution for me, thanks a lot for it.

I know from 3.6, that the batch processor is mighty, but has not so many possibilities like Photoshop of course.
Hence PS would really be a good thing for me.

I do writing a script, well, ahem, copy and paste code, add this here and there, what you call this kind of "scripter"?  8) :-\

I have now a running script, where you can
- select one or more image
- let run the script and in a box I can choose
- some stuff like add a border, add some things from the IMImage class
- choose, if I want add some Metadata at the bottom of the image
- choose the size of the images
- choose, how many rows in a table
- choose, if I want save the image in original size or reduced or both
------

After this, the script displays each image on screen, opens Word, adds the images in the table with some metadata under each image (if wished), saves the images (if wished) and that it is.

I end up with a neat Word-Document (for journalists for example), and each image saved (with Metadata inside the image, if wished or copyright-sign and so on).

But because IMImage does not offer that lot of things (or not so convenient) like the Batch processor, I came on the idea, to integrate the batch processor at one point in the script.
For example, after the IMImage classes has been done (say a border and Headline at the bottom of the image) some work, let run this image throught the batch processor and then run the script further.

I will try, if something is possible with your script. If yes, then this is great ... if not, well, then I will work "only" with the IMImage class, I think, it offers quite a lot of things.

BTW, I for my script I took the IM5-script "Render XAML Markup" as the basic.


Best wishes from Switzerland! :-)
Markus

Ferdinand

Markus,

I know what you are trying to do.  I have read your other posts.

My script drives Photoshop from inside IMatch.  Adobe provides a lot of documentation on how to do this. 

It should be possible to write a similar script to drive Word from inside IMatch.  In theory, the techniques I used in my Photoshop script could be used to do what you want to do.  The problem is that I can't see the same sort of documentation for Word.  (I had a quick look).

I don't have time right now.  I am going away for nearly two months.  Perhaps when I am back.



sinus

Quote from: Ferdinand on June 02, 2014, 01:21:13 PM
Markus,

I know what you are trying to do.  I have read your other posts.

Ah, Ferdinand sees everything!  :D

Quote from: Ferdinand on June 02, 2014, 01:21:13 PM
It should be possible to write a similar script to drive Word from inside IMatch.  In theory, the techniques I used in my Photoshop script could be used to do what you want to do.  The problem is that I can't see the same sort of documentation for Word.  (I had a quick look).

I don't have time right now.  I am going away for nearly two months.  Perhaps when I am back.

Oh, so I wish you a very good time, hopefully a good thing for you!
I will have a look at your script, but I am afraid, that I will not be able to "integrate" it into my script.
But it is really not that important for me, because at the moment the script does, what I want (takes the selected images, does some stuff with it (metas, border), pushes them into the word-table, save the images and displays them on the monitor).
Finally that is all, what I need, all other things (batch processor or does some work with Photoshop) would be a fine enhancement.

I am more then happy, that I could it manage, that it runs (with help of Mario and John). If you are interested and have the time, here is the actual code, what works for me (it opens a predfined word-doc).

But of course ... have a good time, when you are away.

[attachment deleted by admin]
Best wishes from Switzerland! :-)
Markus

Ferdinand

You won't be able to "integrate" my script - it does very different things.  But the approach will be similar. 

It looks to me like your script is already part of the way there.  It looks to be using the same approach.

Does your script run on your computer?  It didn't on mine.  I can see some changes that I might be able to make that would make it run.

Ferdinand

OK, I found your old V3.6 script and found that I needed to add in some "references" into the V5 one.  Now it runs.  Or at least the dialog box appears.

So now I realise that you are very advanced with this script.  So forget my previous comments.

What things does the batch processor do that you want to do in this script?







sinus

Quote from: Ferdinand on June 02, 2014, 02:53:45 PM
OK, I found your old V3.6 script and found that I needed to add in some "references" into the V5 one.  Now it runs.  Or at least the dialog box appears.

So now I realise that you are very advanced with this script.  So forget my previous comments.

What things does the batch processor do that you want to do in this script?

Hi Ferdinand
Sorry, I should have say that you must enable some references, sorry!

The script does quite a lot of things, what is very nice for me. Say, I can select 10 images, create some nice borders with some metadata at the bottom of the file, let save the images, let create a word-doc and for controlling I can see the images on the screen (what I want later also make a choice, if I want it or not).

And finally I can deliver this all very quickly to my friends or clients.

Hmmm, I feel you  ;D maybe you want say, a lot of the things in the batch processor I can do by scripting.
I think, in the batch processor it is easy to add canvas and specialy shadows.

Also the effects  are very nice and easy to set in the batch processor. Hmmm, yes, I think, a lot could be done by scripting, but do not forget, I am a very poor "cut-n-paste scripter" so lets say to add a shadow or some vignetter is not that easy!

BTW: a pity, that my script does not run or your pc.
I think, there are some lines to change, like this one for choosing the outputfolder:

Const outputfolder As String = "C:\Users\zuki-7\Desktop\zum senden tmp\wordcontact\"

and here a word-doc will be loaded (what could be simply a page with a line or a word and saved once)

Set oDoc = oWord.Documents.Open (FileName:="""C:\00_timeline-aktuell\neu_checken\Vorlagen\Bilderdruck-normal-A4.doc""", _

I think, then the script should run ... of course only, if you have installed Word ;)




Best wishes from Switzerland! :-)
Markus

Ferdinand

Yes, I got the script to work.

I think if you want to do more things with the image then the easiest way is to use the IMImage class.  That may not be what you wanted to hear, but that's still the best answer.

You could use some of my code from my script and do these things in photoshop, but you will have the same problems as you have now - you need to understand the code, and in fact it would be harder to understand my code than to understand the IMImage class.

Adding canvas is easy in IMImage, but I think a drop shadow is a bit harder.

sinus

Quote from: Ferdinand on June 02, 2014, 04:25:34 PM
Yes, I got the script to work.

I think if you want to do more things with the image then the easiest way is to use the IMImage class.  That may not be what you wanted to hear, but that's still the best answer.

You could use some of my code from my script and do these things in photoshop, but you will have the same problems as you have now - you need to understand the code, and in fact it would be harder to understand my code than to understand the IMImage class.

Adding canvas is easy in IMImage, but I think a drop shadow is a bit harder.

Hey Ferdinand

Thanks a lot for your answer and your thoughts.
I agree with you, and I will try to do it with the ImImage class.
The good thing for me is also, that I have some good sample scripts, provided by IM and other users.
So I will be able to do, what I want ... I think and hope!  :D

Thanks for your help!

BTW: it is faszinating, what can be done by a script. I added now simply a choice in the box, if we want to display the image on screen or not, and the a simple if then ...

Great, if I choose not to display the image on screen, then I can select, say 100 images and let put them into the word-document. Really cool.
Best wishes from Switzerland! :-)
Markus