Post

Today I finally got some examples running of using the #photoShop cloud API online. Not Pretty at all. Would love to have alternatives. But it’s shocking that image libraries like sharp (libvips) have no transformations for layers beyond affine matrices. No perspective bit warp. Wild. Sad.

0 reposts1 like

sharp caps out at affine, but libvips itself doesn't: vips mapim takes an arbitrary coordinate map, so a 3x3 homography works — wasm-vips exposes it too. In the browser a perspective warp is just a textured quad in WebGL, or cv.warpPerspective in opencv.js. No cloud round-trip needed.

You can do tricks like generating the map at lower resolution if the transform is expensive to compute, but it should usually be fast enough I think. For that 6k x 4k JPG I see: $ time ./cod.py ~/pics/theo.jpg x.jpg real 0m0.408s user 0m1.780s sys 0m0.360s