Skip to content

Commit

Permalink
Resize images example
Browse files Browse the repository at this point in the history
  • Loading branch information
runabol committed Sep 18, 2023
1 parent 36e8274 commit c25ae8b
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ services:
- 5000:5000
web:
image: runabol/tork-web
platform: linux/amd64
restart: always
ports:
- 8100:3000
Expand Down
65 changes: 65 additions & 0 deletions examples/resize_image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: job output example
description: |
This job takes an input source image and resizes it to multiple outputs.
This demo assumes a locally running instace of Minio (AWS S3-like service) which will be used to
store the outputs at.
You can get a running instance of minio using the following command:
docker run --name=minio -d -p 9000:9000 -p 9001:9001 minio/minio server /data --console-address ":9001"
You'll like have to change the endpointURL below to the IP address of your minio server
The default credentials for a Minio Server are minioadmin/minioadmin
inputs:
accessKeyID: minioadmin
endpointURL: http://my-minio-server:9000
secretKeyID: minioadmin
source: https://upload.wikimedia.org/wikipedia/commons/c/ca/Bbb-splash.png
target: s3://my-bucket/my/folder
tasks:
- name: get the file extension of the source
var: fileExt
image: alpine:3.18.3
env:
SOURCE: "{{ inputs.source }}"
run: |
FILENAME=$(basename -- "$SOURCE")
EXT="${FILENAME##*.}"
echo $EXT > $TORK_OUTPUT
- name: Convert the image to various resolutions
each:
list: "{{ ['1920x1080','1366x768','1280x720','768x1024','100x100','200x200'] }}"
task:
name: "Scale the image to {{ item.value }}"
volumes:
- /tmp
image: dpokidov/imagemagick
env:
EXT: "{{ tasks.fileExt }}"
SIZE: "{{ item.value }}"
run: |
mkdir /tmp/targets
convert "/tmp/source.$EXT" -resize $SIZE "/tmp/targets/$SIZE.jpg"
pre:
- name: download the remote file
image: alpine:3.18.3
env:
SOURCE: "{{ inputs.source }}"
EXT: "{{ tasks.fileExt }}"
run: |
wget $SOURCE -O "/tmp/source.$EXT"
post:
- name: upload the converted image to minio
run: aws --endpoint-url $ENDPOINT_URL s3 cp /tmp/targets/$SIZE.jpg $TARGET/$SIZE.jpg
image: amazon/aws-cli:2.13.10
env:
AWS_ACCESS_KEY_ID: "{{inputs.accessKeyID}}"
AWS_SECRET_ACCESS_KEY: "{{inputs.secretKeyID}}"
TARGET: "{{inputs.target}}"
ENDPOINT_URL: "{{inputs.endpointURL}}"
SIZE: "{{ item.value }}"


14 changes: 14 additions & 0 deletions examples/split_and_stitch.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
name: split and stitch demo
description: |
this job splits an input video into 10s chunks, transcodes the various chunks in parallel,
and finally stitches the final result into a single file.
This demo assumes a locally running instace of Minio (AWS S3-like service) which will be used to store the
video chunks and the final video output
You can get a running instance of minio using the following command:
docker run --name=minio -d -p 9000:9000 -p 9001:9001 minio/minio server /data --console-address ":9001"
You'll like have to change the endpointURL below to the IP address of your minio server
The default credentials for a Minio Server are minioadmin/minioadmin
inputs:
accessKeyID: minioadmin
endpointURL: http://my-minio-server:9000
Expand Down

0 comments on commit c25ae8b

Please sign in to comment.