question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for image compression

See original GitHub issue

In response to the following tweet https://twitter.com/dan_abramov/status/805036037940592641 I would love to make a pull request for adding image compression. But i do have a concern and would like to have a discussion, before proceeding with the pull request.

The webpack loader for image compression i used is https://github.com/tcoopman/image-webpack-loader I used the following config

{
      test: /\.(jpe?g|png|gif|svg)$/i,
       loaders: [
	    'file?hash=sha512&digest=hex&name=static/media/[name].[hash:8].[ext]',
	    'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false'
	]
}

i deliberately omitted pngquant support as it has been reported buggy by several user using this library (though i haven’t found any issues yet). https://github.com/tcoopman/image-webpack-loader/issues/45 https://github.com/tcoopman/image-webpack-loader/issues/42 . One other library to consider is https://github.com/thetalecrafter/img-loader. It is relatively less popular but haven’t had issues and also it fixes issues for people who had trouble with image-webpack-loader.

Any opinions ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
alexdorcommented, Jun 11, 2018

@gaearon How about adding a precommit hook that runs imagemin only when there is an addition or an edit of an image?

1reaction
cesarandreucommented, Dec 17, 2016

One downside of using a loader to compress images is that it has to run for every build. I compress my images with imagemin before adding em to the repo. It has a CLI and desktop app as well. Maybe suggesting that in the docs is another option?

Read more comments on GitHub >

github_iconTop Results From Across the Web

TinyPNG – Compress WebP, PNG and JPEG images ...
TinyPNG optimizes your WebP, PNG and JPEG images by 50-80% while preserving ... compression for JPEG images and in 2016 we added support...
Read more >
Compress a picture - Microsoft Support
Select the picture you want to compress. Click the Picture Tools Format tab, and then click Compress Pictures. Do one of the following:....
Read more >
15 Best Free Image Optimization Tools for Image Compression
Best Free Image Optimization Tools for Image Compression · 1. JPEG Optimizer · 2. Optimizilla · 3. Kraken.io · 4. Optimole · 5....
Read more >
What is image compression and how does it work? - TechTarget
Image compression is a process that minimizes the size of graphics file to an acceptable point. Learn about two compression methods: lossy and...
Read more >
Online Image Сompressor
Our tool uses lossy compression to shrink down image files. It supports three file types: PNG, JPG/JPEG, and GIF. This system intelligently analyzes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found