PicMonkey's online photo editor API allows you to add best-of-breed photo editing tools to your website without lifting a finger. (You can type a few lines of code with your toes, right?) Your users will be able to unleash their inner genius, have a feeding frenzy on crazy-awesome effects, and save their final edited photo back to your servers, all while singing your praises for providing them with the photo goodness. You can access an API key here: https://www.picmonkey.com/api
The PicMonkey API is pretty easy to use: you just load a URL in a browser window (or iframe). The base URL is always https://www.picmonkey.com/service. In most cases, you can launch an API request with either a GET or a POST. You also must pass your API key in the _apikey parameter. Please contact us at firstname.lastname@example.org to get one.
All of the examples here will use 00112233445566778899aabbccddeeff as the API key. For example: https://www.picmonkey.com/service?_apikey=00112233445566778899aabbccddeeff
In most use cases, you’ll want to have PicMonkey automatically load an image. The key to making this happen is the _import parameter. You can either specify a URL or a POST form field containing the image you wish to open.
Loading a URL
http://www.picmonkey.com/service ?_apikey=00112233445566778899aabbccddeeff &_import=https%3A%2F%2Fwww.picmonkey.com%2F_%2Fstatic%2Fimages%2Findex%2Fsample_images%2Fseasonal%2Fhalloween_vampire.jpg
Loading from a POST
<form method="post" action="https://www.picmonkey.com/service/" enctype='multipart/form-data'>
<input type="hidden" name="_import" value="image_file"/>
<input type="file" name="image_file" size="30">
<input type="submit" value="Upload this image"/>
<input type="hidden" name="_apikey" value="00112233445566778899aabbccddeeff"/>
PicMonkey provides two main ways to get the edited image back to your servers. We can send it directly via a POST, or we can send a temporary URL (via GET or POST) that you can use to fetch the image. The POST method is generally the most efficient. The default is the ‘direct POST’ method.
To receive a direct POST of the edited image, pass the following parameters to the API:
_export = <the url to POST data to (make sure this is URL encoded!)>
_export_agent = “server”
_export_method = “POST”
After the post is complete, the browser itself will navigate to the _export url. If you’d like to go to a different URL, pass it along in the _redirect parameter.
To receive a temporary URL, pass these parameters:
_export = <the url to POST data to (again, make sure this is URL encoded)>
_export_agent = “browser”
_export_method = “POST” or “GET”
You may want to ask the user if it’s OK to overwrite an image when saving. This feature is controlled via the _replace and _imageid parameters. The _replace parameter can take four possible values. The combination of those values and the user’s actions control whether or not _imageid is included as a parameter on the export request.
- no: _imageid is never passed through. This is the default.
- yes: _imageid is always passed through
- ask: The user is asked if they would like to replace the image or save a new copy. If they say ‘replace’ _imageid is passed through, otherwise it’s not passed.
- confirm: The user is asked if they would like to replace the image. If they say ‘yes’, _imageid is passed through. If they say ‘no’, they are returned to the editor.
There is no requirement that _imageid actually be the ID of anything. For example, you could always pass a constant, and simply use its existence to determine whether or not to replace the image.
Specifies the image to load
Desktop software can POST an image to the API and pass _returntype=text to receive a URL that can then be loaded in a browser.
Pass a title to be used when saving an image to a user's computer.
URL to use for exporting an image
Where should the export originate from
Name of the field to contain the exported image
Should the export be via HTTP GET or POST?
The 'id' of the image being edited. See above for more information.
Optionally ask the user before overwriting. See above for more information.
The output file format (png or jpg). jpg is the default.
The output compression quality (1-10). The default is 8.
Maximum output width in pixels.
Maximum output height in pixels.
URL for a destination when the user selects "close"
URL to redirect the browser to after export.
UI elements to disable. Currently, only the value of ‘in’ is supported. If specified, the upload button will be hidden.