1 hour ago · Tech · hide · 0 comments

Smaller images for the webTo prepare my images for my website to be smaller and progressively loaded, I had been using `imagemagick`. But my computer is now too old to properly install it with homebrew or macports, so I had to find another solution.imagemagickI found `sharp`, which is an NPM package, which I don't love, but gets the job done and is very lightweight in comparison.sharpThe big things I try and do for image processing for the web are:Lower quality to remove hyper detailSmall amount of gaussian blur to reduce file sizeInterlacing to allow progressive loading on bad connectionsRemove EXIF metadata that is not relevantWhat I did with `imagemagick` was:magick "$file" -strip -gaussian-blur 0.05 -interlace Plane -quality 25 "$output" What I'm doing with `sharp` now is:const output = await sharp(file) .rotate() .blur({ minAmplitude: .05, sigma: .5, }) .jpeg({ quality: 25, progressive: true, optimiseScans: true, force: true, }) .toBuffer(); fs.writeFileSync(outputFile, output);…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.