by Devin Yang
(This article was automatically translated.)

Published - 4 years ago ( Updated - 4 years ago )

Preface

This article describes how I use docker to optimize my own image files.
Directly shrink the image files in the directory, and optimize the graphics with one line of command.

This is the repo I created on GitHub, download it and build your own image to use it

Please note that the original image will be changed directly!!

https://github.com/DevinY/optimize-image

Build your own image can use the following commands:

docker build -t optimize-image .


I use this command to update image files with text content

docker run --rm -v ${PWD}:${PWD} optimize-image ${PWD} -mw 900 -q 80


Please note that you have a backup of the original image, I use this command to update the super large pattern on my website

docker run -rm -v ${PWD}:${PWD} optimize-image ${PWD} -mw 1620 -q 20

actual operation screen

Before the start, there are 3.9M and 3.8M. The following are the pictures before the update

The moment of witnessing the miracle, after execution

docker run -v ${PWD}:${PWD} optimize-image ${PWD} -mw 1620 -q 20

The result after performing optimization is directly less40MB, the picture file is reduced to a few Hundred KB.



 

Tags: seo

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


laravel,dotenv,seo

How do I dynamically load different dotenv files in Laravel according to the subdomain name

Before we start, let me complain. Originally, my website could automatically display different languages ​​according to the user's browser. That's okay, but Google's SEO doesn't seem to like it. He recommends using different URLs for each language and not using cookies or browser settings to adjust the content of the page. Well, I'll just be obedient. His suggested method, the first solution: distinguish by country, such as example.tw or example.de, how is this really impossible, or buy the registered domain name, or take all the domain names and no one will take it The strange domain name is more likely. The second solution: use sub-domain names to distinguish, this is what I am going to do, and so on to explain how to do it in Laravel. The third solution: example.com/tw/ and the like, Apple seems to do it this way. The fourth solution: site.com?loc=tw and the like are not recommended, indeed I think this is not a good idea.

docker,polymer,seo

Solving Polymer SEO Problems with Rendertron (Polymer Summit 2017)

The video below the article introduces how to use rendertron to solve Polymer SEO optimization problems. In the source of my fork, it has been adjusted to support the Chinese environment. And also added the API interface of pdf, which can also be used to convert pdf.