Sign inSign up

westwind027/image-magick

By westwind027

•Updated about 4 years ago

Image
0

295

westwind027/image-magick repository overview

⁠image-magick 1.0.0

Image modifications in Direktiv



⁠About image-magick

This app can run multiple Image Magick⁠ commands. The results can either be stored in the output folder of Direktiv to store them as variables or returned as base64.

⁠Example(s)
⁠Function Configuration
functions:
- id: image-magick
  image: direktiv/image-magick
  type: knative-workflow
⁠Basic
- id: img
  type: action
  action:
    function: image-magick
    input:
      commands:
        - convert mypic.png json:
        - convert mypic.png -fuzz 25% -fill red -opaque white -flatten mypic.png
        - convert mypic.png -resize 200x100 mypic.jpg
      return:
        - mypic.png
⁠File Resize
- id: set
  type: setter
  variables:
  - key: mypic.png
    scope: workflow
    mimeType: application/octet-stream
    value: iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAH0lEQVR42mNk+P+/noGKgHHUwFEDRw0cNXDUwJFqIAAczzHZPJWe1QAAAABJRU5ErkJggg==
  transition: modify
- id: modify 
  type: action
  action:
    function: image
    files:
      - key: mypic.png
        scope: workflow
    input: 
      commands:
        # stores the image in workflow scope variable `resized.png`
        - convert mypic.png -resize 200% out/workflow/resized.png 
⁠Request
⁠Request Attributes

PostParamsBody⁠

⁠Response

Response contains the results of the command and the requested images as base64.

⁠Reponse Types

PostOKBody⁠

⁠Example Reponses
[
  {
    "result": "",
    "success": true
  }
]
[
  {
    "result": "iVBORw0KGgoAAAANSUhE...lFTkSuQmCC",
    "success": true
  }
]
⁠Errors
TypeDescription
io.direktiv.command.errorCommand execution failed
io.direktiv.output.errorTemplate error for output generation of the service
io.direktiv.ri.errorCan not create information object from request
⁠Types
⁠ postOKBody

Properties

NameTypeGo typeRequiredDefaultDescriptionExample
commands[]PostOKBodyCommandsItems⁠[]*PostOKBodyCommandsItemsList of results for the commands.
images[]PostOKBodyImagesItems⁠[]*PostOKBodyImagesItemsList of base64 encoded images.
⁠ postOKBodyCommandsItems

Properties

NameTypeGo typeRequiredDefaultDescriptionExample
resultinterface{}⁠interface{}Empty for conversion commands and
JSON for json returning commands.
{"image":{"alpha":"sss"}}
successbooleanboolIndicates successtrue
⁠ postOKBodyImagesItems

Properties

NameTypeGo typeRequiredDefaultDescriptionExample
resultstringstringBase64 encoded image stringiVBORw0KGgoA...AABJRU5ErkJggg==
successbooleanboolIndicates successtrue
⁠ postParamsBody

Properties

NameTypeGo typeRequiredDefaultDescriptionExample
commands[]string[]string✓List of commands to runconvert mypic.png -resize 200x100 mypic.jpg
return[]string[]stringReturns the images as base64myimage.jpg

Tag summary

Content type

Image

Digest

sha256:1ac23422e…

Size

126.6 MB

Last updated

about 4 years ago

docker pull westwind027/image-magick