https://img.surfbabe.dk/<command>/<img url>
syntax is: https://img.surfbabe.dk/<command>/<img url> Commands can be any of these: convert_avif convert_png convert_jpg convert_gif convert bmp info - returns JSON info about image file. i.e. height, width, file size, EXIFF data if any rotate_90 rotate_180 rotate_270 cut_x_y_w_h - cuts or crops an image part resize - limits the height or width and scales the image width same radio gray - converts colour into gray scale image blur - blurs image sharpen - sharpens image Some sample urlshttps://vandsport.dk/bucket/file/a5391011-d0fa-8588-6ff8-c36686e7630c/raw/a22e85f6-6f32-4cef-a13e-1783ea867183.JPG
https://content.ttsoftware.dk/a5391011-d0fa-8588-6ff8-c36686e7630c/raw/a22e85f6-6f32-4cef-a13e-1783ea867183.JPG
http://img.surfbabe.dk/convert_avif/https://vandsport.dk/bucket/file/a5391011-d0fa-8588-6ff8-c36686e7630c/raw/a22e85f6-6f32-4cef-a13e-1783ea867183.JPG
this project is a very simple image converter based on image magick
to use it simply add the command in front of your image url:
img.tt.dk/<command>/<ulr>
i.e.
img.tt.dk/type_avif/https://vandsport.dk/bucket/file/a5391011-d0fa-8588-6ff8-c36686e7630c/raw/a22e85f6-6f32-4cef-a13e-1783ea867183.JPG
or locally:
http://localhost:5000/convert/https://asset.dr.dk/drdk/umbraco-images/3xfp2h0x/20230131-151506-l.jpg?im=AspectCrop%3D%281700%2C1133%29%2CxPosition%3D.5%2CyPosition%3D.5%3BResize%3D%281700%2C1133%29&impolicy=mediumlow
allowed commands could be:
type: png,jpg,webp,avif
rotate: 90,180,270
cut: x,y,w,h - i.e. cut_75_20_557_420
resize: x,y - max width and max height
we can also load an url from the command line and get the reply:
loadurl_string - upload image and get the filename on server, i.e. "/app/input/G9D/test.png"
loadurl_json - upload image and get JSON back
loadurl_data - upload image and get raw data back
now we can start scripting from the command line with curl:
1. upload a file
curl -F 'file=@/home/grob/kode/image/test.png' localhost:8000/fileupload_string
2. send the file on the server to be rotated 90 degrees
curl localhost:8000/rotate_90/<response from above> -o test.png
or as a one liner:
curl -F 'file=@/home/grob/kode/image/test.png' localhost:8000/fileupload_string | xargs -I I curl localhost:8000/rotate_90/{I} -o test.png
maybe convert all png files to be avifs?