Closed satyamtg closed 3 years ago
Merging #75 (91bd685) into master (b895fc7) will not change coverage. The diff coverage is
100.00%
.
@@ Coverage Diff @@
## master #75 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 25 25
Lines 997 1007 +10
=========================================
+ Hits 997 1007 +10
Impacted Files | Coverage Δ | |
---|---|---|
src/zimscraperlib/image/optimization.py | 100.00% <100.00%> (ø) |
|
src/zimscraperlib/image/probing.py | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update b895fc7...91bd685. Read the comment docs.
This adds image optimization on the fly for JPEG/WebP and PNG files. GIFs are not supported as I wasn't able to achieve any better compression than the original file in most of my tests using Pillow. Using gifsicle would mean not doing it "on the fly"
Here's a list of major changes -
The methods
optimize_jpeg()
andoptimize_png()
now use the methods fromoptimize_images
directly for processing the image in different stages rather than making aTask
and using optimize_images task for that. This has several benefits -Unnecessary functions like run_optimize_images_task() and
create_temporary_file()
are now removedThe return value now also contains the path of the destination or the BytesIO object that contains the optimized image
Todo -