Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”

This article has participated in the “Digitalstar Project” and won a creative gift package to challenge the creative incentive money

Hello, I’m Shanyue.

Devtool. tech/tiny-image.

I’m going to call this app Micrograph, which means smaller images. The site is placed in my gadget collection devtool.tech/tiny-image.

Supports JPEG, PNG, WebP and other image formats, with no limit on image size or size, and can be downloaded in batches as compressed packages.

You know, just unlimited size is beyond most online image compression tools, and there are no ads. Moreover, any comments can be added to mount moon friends directly put forward.

Another key point is that browser-only compression is not stored on the server, so it is faster and has no security issues. Compared with the mountain month, it is less willing to use some online tools to compress personal ID pictures and so on.

Wasm and Mozilla JPEG /oxipng are used for image coding, so it has high performance and compression algorithm support. This is why the tool can compress images in the browser.

The original

The tool was originally intended to reduce the size of images to improve site performance.

In two years ago, I intended to do a picture compression tool, there are two solutions, considering the problems, has been stranded.

  • Browser-side implementation:canvas. Poor performance, Pass.
  • Server-side implementation: There are two approaches.
    • Use sharp and other tools to build their own server implementation. The server is under too much pressure, and the website is not recorded, Pass (mainly feel troublesome)
    • With the help of OSS image processing functions. Paid and easy to steal, Pass

I recently started learning WASM and finally had a solution that was both performance and cheap, so I made a rough version in two days.

New function implementation

At present, the main function has been realized, and I am also a high-frequency user, but there are still some shortcomings, displayed below, will be gradually realized.

  1. Pictures can be set to zoom scale. Most of the time images don’t need to be this big.
  2. Images can be compressed before and after preview. After preview, you can directly copy the image by right clicking, no need to download.
  3. Images can be set to webP. Webp is smaller.
  4. Currently, wASM compression is still in the main thread, and too many images may cause stuttering

Next tool

The previous tool was a preview for viewing EXIF information. Not many people have used it since it was published (and I don’t use it myself either). This leads to a truth that only the tools you use more can have a steady stream of motivation to continue to improve, otherwise they will be abandoned.

This time the tool is image compression.

The first two were pictures, so what should I do next time?