address

Project address: tinypng-upload

If you are interested, you can play with it, because you often use image compression and upload. If you feel cumbersome, this will solve your pain point.

About tinypng – upload

This is an image compression and upload tool based on electron. The compression process is completed by calling the API provided by Tinypng. Upload configuration Refer to iView file upload configuration. Because it is desktop, it is very convenient for us to drag the picture to the task tray for compression upload, which greatly improves the front-end work efficiency and allows us to focus on business development.

Operation process:

Volume comparison before and after compression (the picture has been automatically uploaded to the CDN referred to after compression) :

use

1. Download the executable file

Since it is not published to the app store, we need to compile the executable ourselves:

git clone https://github.com/muwoo/tinypng-upload.git
cd tinypng-upload
npm i
npm run build
Copy the code

Then the corresponding executable file will be generated in the build directory and run the modified file

2. Configure the Tinypng API key

Since the compression process of this project is realized by calling tinypng API, we need to register an API key on the Tinypng website:

Then paste this value into our configuration column:

With a limited amount, the free app can compress up to 500 images per month. Github also generates multiple account API keys through a circular registration process to achieve the purpose of almost unlimited compression times. Have interest also can understand ~

3. Configure a compressed image upload request

After compression is completed, we hope that the image can be directly uploaded to our company’s CDN. Tiny-png upload Refers to iView’s image upload parameters and Settings: upload upload

Property Decription Type Default
action Upload request URL, required. String
headers Upload request header. Object {}
data Extra data with upload request. Object {}
name The key in upload request targeting to the file. String file
with-credentials Enable certification info in Cookie or not. Boolean false

inspiration

I read an article about PicGo, a tool for electron image uploading, on The Nuggets before. Thank you very much for the article the author provided referring to PicGo’s heart course of breaking 1000 star number.