Comments (11)
As this package is under MIT licence, I develop a special version to handle those problems and add more features.
- I add a min size boundary, image under this size will not be compressed.
- specify the number of workers, cpu_count() may not give correct data in some devices.
- collect data from IO streaming rather than disk.
- do not save temp file in disk, but use ByteIO to save them in memory. Disk IO for IoT is expensive.
Thanks for the framework you provided, I need to handle hundreds NAS and IoT devices with different platforms, some famous implementations can not be complied through all kinds of architectures. I used to try to develop a package by my own, but I found this pure python implementation with PIL. It really helps me !
from optimize-images.
Hi! Thanks for your observations!
Nice to know that it is being also useful for you. Please, always keep in mind that the image optimization performed by this application is lossy/destructive. It was designed mainly to automate image compression for web, and not intended to process original files in place.
Regarding the exceptions, do you have some image(s) that may suffer from such corruption that could be used for testing and further development? I tried to keep it simple and let it run silently, as much as possible, but there could be cases where it stops. I would like to better investigate those cases, which I may not have faced yet.
from optimize-images.
Hi,
I used it on various NAS/IoT devices for security and privacy control, the compressing reduce the Internet I/O pressure. I cant give you example images due to privacy consideration, some of the images are collected from medical instruments.
There actually more exceptions need to catch, For example
This may raise
IOError: cannot identify image file
when image is broken which is usually happened in data streaming scenario.
Another problem
You did not check the format here, but relay on the extension check in search_image.
Sometimes tiff or other images may be mistaken as *.jpg or *.png, those files will be included in Tasks and you do not really check the exact format in Image.format with PIL.
from optimize-images.
Thanks very much for the feedback! I will try to look into those issues as soon as I can, but it could take some time, as I am currently in the middle of other activities.
By the way, in case you feel inclined to contribute back with some of your code, please feel free to submit a Pull Request.
from optimize-images.
Hello! I'm having the issue where it stops after a certain image with broken EXIF,
I need it to optimize a rather large (24GB) images folder for web.
Cheers,
José
from optimize-images.
I will try to issue an update soon that should catch some of those exceptions.
Meanwhile, it would really be helpful if someone could provide one of those problematic images (as long it does not contain any relevant data that should not be exposed), for testing purposes.
from optimize-images.
Sure! Can I have your email address?, for sending you the image privately
from optimize-images.
Please send it to:
editor [dot] arcosonline [at] gmail [dot] com
Thanks!
from optimize-images.
Sent, thank you very much for your help!
from optimize-images.
@kikohernandez92 @lizequn I will be releasing v.1.3.1 with a quick fix for the piexif
Exception issue. At this time, I decided to simply extend the previous behaviour of ignoring EXIF in case an exception is raisen. I may take another look at this in case the current fix is not enough and a better solution is found.
I also added a few "todo" annotations regarding the other potential issues mentioned above. Right now I am more busy that I had expected, with less time to investigate these, but I intend to get back to them as soon as I can.
Meanwhile, in case someone feels ok with sharing some improvements, please feel free to submit a pull request. I promise to take a look ;-)
from optimize-images.
@lizequn Just a quick notice to let you know that, on the latest commit (not yet available in PyPI), I have implemented in-memory buffers using BytesIO, instead of in-disk temporary files.
We also had recently a new CLI parameter to specify the number of simultaneous jobs.
Currently, it saves the processed file if the file saving was at least 1% but we may provide some parameterisation for this in a future release.
from optimize-images.
Related Issues (20)
- skip optimization on error, don't exit process HOT 1
- log what file is raising error HOT 6
- Use imghdr.what() to detect image type from file signature in do_optimization()
- Skip non-image file types HOT 4
- AttributeError: 'NoneType' object has no attribute 'orig_size' HOT 3
- Command line icons not properly shown in Windows HOT 5
- PIL.UnidentifiedImageError: cannot identify image file HOT 6
- Keep Image resolution (DPI) HOT 3
- Allow export to format ".webp" HOT 2
- [Feature Request] Option to skip files raising exceptions. HOT 2
- Read-only file system /~temp~image.png HOT 7
- Convert png to jpg regardless of size HOT 2
- [Feature Request] Docker support HOT 10
- Brunsli support? HOT 1
- Claims Pillow isn't installed while it is? HOT 5
- Skips png's HOT 2
- Ability to Suppress Output HOT 2
- UnboundLocalError: local variable 'has_exif' referenced before assignment HOT 4
- Error with Pillow 8.2.0 and python 3.10 HOT 3
- Destroys EXIF data despite --keep-exif HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from optimize-images.