Skip to content

Instantly share code, notes, and snippets.

@DocumentAlchemy
Last active April 19, 2016 00:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DocumentAlchemy/4f842c0f115834470a5abdb908cd9967 to your computer and use it in GitHub Desktop.
Save DocumentAlchemy/4f842c0f115834470a5abdb908cd9967 to your computer and use it in GitHub Desktop.
An example of using curl and the DocumentAlchemy API to resize an image.
# Example of using curl and the DocumentAlchemy API to render a
# scale an image to fixed width while preserving the orignal
# aspect ratio.
# This particular example will work with PNG and JPEG files,
# and convert any input JPEG documents to PNG.
# See <https://documentalchemy.com/> for more information about
# DocumentAlchemy's document conversion and processing capabilities.
# Assuming:
#
# - `403l1zh3dkbakyb9` is the value of your Document Alchemy API key,
# - `IMAGE.PNG` is the image you want to resize
# - `IMAGE-240.PNG` is the file you want to save the resized image to.
#
# the following command will upload the image to DocumentAlchemy
# and download the transformed image:
curl -H "Authorization: da.key=403l1zh3dkbakyb9" \
-X POST --form "document=@IMAGE.PNG" \
https://documentalchemy.com/api/v1/document/-/rendition/png/transform/S240,0 \
-o "IMAGE-240.PNG"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment