You have to login in order to post a reply to this topic.

16 replies [Last post]
photoevents
User offline. Last seen 2 hours 44 min ago. Offline
Joined: 09/08/2010
Posts: 31

I'm trying to automate overlaying images using imagemagick.

This is the command I constructed which goes into the Run DOS Command box:

convert "c:\AutoPrint_WA\IN\\%FileTriggerFileName%" -resize 1800x1205 -crop 1795x1205+0+0 "C:\AutoPrint_WA\OVERLAY\overlay.png" -compose over -composite "c:\AutoPrint_WA\MERGED\\"%FileTriggerFileName%"

Folders are hardcoded

A File monitor trigger was added.

But something does not work.

After dropping a jpg file in c:\AutoPrint_WA\IN\ I see the message job completed succesfully but I see no files addes in the c:\AutoPrint_WA\MERGED\ folder.

When typing this command (with real filename) in a regular command window it does work so the command line should be fine.

What am I doing wrong?

Christian

photoevents
User offline. Last seen 2 hours 44 min ago. Offline
Joined: 09/08/2010
Posts: 31
exact and working command line

convert c:\AutoPrint_WA\IN\test.jpg -resize 1800x1205 -crop 1795x1205+0+0 C:\AutoPrint_WA\OVERLAY\overlay.png -compose over -composite c:\AutoPrint_WA\MERGED\final.jpg

Samantha
Samantha's picture
User offline. Last seen 1 hour 9 min ago. Offline
Joined: 04/23/2010
Posts: 1353
Re: using imagemagick to overlay images

Hello there,

please try the job attached ;) it should do the trick ;)

:)
Samantha

AttachmentSize
photoevents.waj 14 KB
__________________

Rome wasn't built in a day..

__________________

Rome wasn't built in a day..

photoevents
User offline. Last seen 2 hours 44 min ago. Offline
Joined: 09/08/2010
Posts: 31
Re: using imagemagick to overlay images

Thanks, but I do not understand exactly what you did.

Where are the photos stored ?

Should I put the overlay.png image on the desktop in a folder called \photos\ ?

By the way, the next action I want to add is a print document, but I would like this to print immediatelly without popping up the dialog. (the idea that comes up now is simply using sendkeys but perhaps there is better way)

Oh, and I'm taking time to read the manual, but this job is a bit urgent.

Christian

photoevents
User offline. Last seen 2 hours 44 min ago. Offline
Joined: 09/08/2010
Posts: 31
Re: using imagemagick to overlay images

Looking at the trigger I understand where to drop the photos.

which i did, but i do not see the final merged picture in the folder \photos\final

and >>>

WinAutomation.DIAgent has stopped working

I'm using windows vista 32bit edition (should upgrade to windows 7 I know :-(

photoevents
User offline. Last seen 2 hours 44 min ago. Offline
Joined: 09/08/2010
Posts: 31
Re: using imagemagick to overlay images

Hmmm, above script does not work for me.

Christian

Samantha
Samantha's picture
User offline. Last seen 1 hour 9 min ago. Offline
Joined: 04/23/2010
Posts: 1353
Re: using imagemagick to overlay images

Hello Christian, In the example I gave u I used the desktop, and on the desktop I had a folder named photos and within it a subfolder. If you check, the code, you should see that the new photo is saved in a subfolder of the photos folder named final. You can always change these paths by altering the code below.

convert "%FileTriggerFilePath%" -resize 1800x1205 -crop 1795x1205+0+0 "%desktop%\photos\overlay.png" -compose over -composite "%Desktop%\photos\final\\%FileTriggerFileName%"

 

convert "%FileTriggerFilePath" -resize 1800x1205 -crop 1795x1205+0+0 "Full path and file name of your overlay image" -compose over -composite "Full path and filename of your new image" 

 

Regarding printing, you can send a print file action, and where you get the window, add a wait for window, and automate the procedure of the print if u know what I mean

Let me know if you need any further assistance

 

 

:)

Samantha

__________________

Rome wasn't built in a day..

__________________

Rome wasn't built in a day..

photoevents
User offline. Last seen 2 hours 44 min ago. Offline
Joined: 09/08/2010
Posts: 31
Re: using imagemagick to overlay images

I got it.
But it does not work.
When running the command from the windows command terminal it creates the merged file as expected.
When running the job whenever I add a picture to the photos folder on the desktop, I do not get a merged picture in the final folder

I reverted to my own command line, but that doesn't work either:

convert "%FileTriggerFilePath%" -resize 1800x1205 -crop 1795x1205+0+0 "C:\AutoPrint_WA\OVERLAY\overlay.png" -compose over -composite "c:\AutoPrint_WA\MERGED\\%FileTriggerFileName%"

What am I doing wrong ?
 

Christian

Samantha
Samantha's picture
User offline. Last seen 1 hour 9 min ago. Offline
Joined: 04/23/2010
Posts: 1353
Re: using imagemagick to overlay images

Hey Christian,

If you check there's also the working folder you must fill in -in the Run Dos Command action-. I have set that one to be my %Desktop%\Photos\ folder (which is the one I'm dropping my photos in.

Also, have you made sure that the folder to which the final image (the composed picture) is being sent to exists?

I cannot think of any other reason why it would not run.

If that one does not work either, please consider attaching the job for me to take a look at, or you could even send an email to the Support Dpt to get it looked into.

:)
Samantha

__________________

Rome wasn't built in a day..

__________________

Rome wasn't built in a day..

photoevents
User offline. Last seen 2 hours 44 min ago. Offline
Joined: 09/08/2010
Posts: 31
solved

I got it to work by simply adding C:\AutoPrint_WA to the Working Folder field in the properties of 'Run DOS Command' Action

Why is that necesarry when all the path information is already filled in the DOS command field?

BUT, it's working, so YEAPIE

Christian

photoevents
User offline. Last seen 2 hours 44 min ago. Offline
Joined: 09/08/2010
Posts: 31
Re: using imagemagick to overlay images

The printing part works too.

BUT, new problem:

When two pictures are dropped at the same time in the watched folder, the file monitor only triggers one time.

Isn't there a cache or something, so even if multiple images are dropped in the folder, they all get a chance to be merged one after the other ?

And also when adding images to quickly the print dialog from time to time does not receive the ALT-P keysequence.

So, in the script i have now:

run dos command
print command
wait for window Print Pictures
send alt p
move file to OUT folder

It works good if I give the script enough time between images uploaded to the IN folder

Christian

Samantha
Samantha's picture
User offline. Last seen 1 hour 9 min ago. Offline
Joined: 04/23/2010
Posts: 1353
Re: using imagemagick to overlay images

Hello Christian,

You can use the For Each File in Folder, after the first file has triggered the job. This way, for each file in that folder, do run specific actions. (make sure you always move the files after you have already edited using WinAutomation and Imagemagick)

Your job should look something like this:

*** File Monitor Trigger fires your Job ***

%Folder% = the folder you are using the file monitor trigger on

- Wait for 5 secs (just to make sure that all files have been successfully copied to the folder.
- Get Files In %Folder% (the folder you are monitoring) (%FilesInFolder%)
- For Each File in %Folder% (%CurrentFile%)
- Run DOS Command
- Print
- Wait For Window (to open and focus on it when it opens)
- Send Keys {Alt}({P})
- Move %CurrentFile% to folder (%Folder%\Done)
- End Loop

What you could also do -if you want to avoid all actions mentioned above-, is: In the job's properties, in the "Run Properties" tab make sure that you have selected the "Run New Instance of a Job" in the Multiple Instances Section.

Hope it works for you

:)
Samantha

__________________

Rome wasn't built in a day..

__________________

Rome wasn't built in a day..

photoevents
User offline. Last seen 2 hours 44 min ago. Offline
Joined: 09/08/2010
Posts: 31
Re: using imagemagick to overlay images

Pretty impressed by your quick feedback each time :-)))

I promise you I will be walking very soon without hand holding.
 

Allowing multiple instances of a Job solves the problem partly.
Only, now more than one Print dialog is open at the same time and sendkeys fails from time to time to send alt-p

In the mean time I'm looking into options to launch a print command from the dosbox.

Christian

photoevents
User offline. Last seen 2 hours 44 min ago. Offline
Joined: 09/08/2010
Posts: 31
Re: using imagemagick to overlay images

Solved the printing too by using irfanview and putting this command in a run dos command:

i_view32.exe final.jpg /print

and that's all

by the way, command line syntax in irfanview seems a lot easier than imagemagick

Samantha
Samantha's picture
User offline. Last seen 1 hour 9 min ago. Offline
Joined: 04/23/2010
Posts: 1353
Re: using imagemagick to overlay images

Did you check any the "Print File" action that WinAutomation has? You could actually avoid all the send keys and rest actions, just by using a "Print File" action. It prints to the default printer, using its default settings.
Check it out !

Btw, does inrfanview does all the nice things Imagemagick does though?

;)
Samantha

__________________

Rome wasn't built in a day..

__________________

Rome wasn't built in a day..

photoevents
User offline. Last seen 2 hours 44 min ago. Offline
Joined: 09/08/2010
Posts: 31
Re: using imagemagick to overlay images

I do not find a 'Print File' action but a 'Print Document' action which brings up the Print Picture dialog box, so i still need to send alt-p

Imagemagick indeed has a lot more going for it

Christian

Samantha
Samantha's picture
User offline. Last seen 1 hour 9 min ago. Offline
Joined: 04/23/2010
Posts: 1353
Re: using imagemagick to overlay images

Yes, Christian, what you could do though, is:

use an "If Window" action, where if window (*Print document*) is open then focus on it and send the keystrokes for ok etc...

;)
Samantha

__________________

Rome wasn't built in a day..

__________________

Rome wasn't built in a day..