This project is read-only.

Callable from the Command Line/DLL?

May 19, 2010 at 1:01 AM

I am just looking for a way that I could specify the file name myself, bring up cropper with specific options, allow the user to capture an image, and then close.

For example,

API: Cropper("c:\users\public\pictures\output.png")

Command Line: Cropper.exe /output c:\users\public\pictures\output.png

Would simply bring up the screen capture utility, user presses enter, file is saved to output.png (or no file is created if the user cancels). Ideally I could pass options as well:

API: Cropper("c:\users\public\pictures\output.png", 0.70, true, true)

Command Line: Cropper.exe /output c:\users\public\pictures\output.png /opacity 0.70 /hide-during true /hide-after true

Would bring up the capture utility with a 70% opacity, hides the window during and after capture, and saves to the specified file.


May 19, 2010 at 4:22 AM

Unfortunately, there really isn't a way to do this.

There are two rather old items that I'll add your feedback too though: Refactor Core.dll for use as an API and Add command line parameters.

Dec 17, 2010 at 2:50 PM

One way to retrofit the ability to programmatically direct cropper onto the current exe:  you could use UI Automation

I've done this with Paint.NET; it's kind of unorthodox but it works. 

See here for a tutorial:

you could do something similar for Cropper.  You'd need to build a "cropperdriver.exe" that starts Cropper, finds the Cropper window, then employs the UIAutomation classes to click the appropriate buttons.

This is a brittle integration strategy. If the names of the UI widgets (like the names used for TextBoxes, buttons, etc) changes, or if the layout of the cropper menus changes in a future version of cropper, then the UIAutomation that was set up for the prior version will no longer work.