PNG saving is slow with Python imageio.imwrite

background

imageio, it's convenient, isn't it?

I wanted to save the image processed data (image) in 8bit or 16bit with lossless compression, so I saved the image with imageio.imwrite in PNG, but for some reason I thought that the script was heavy, but PNG writing It was extremely late.

https://github.com/imageio/imageio/issues/387

It takes about 1 second for an image of about 256x256, and about 0.05 seconds for an uncompressed image with BMP or TIFF.

Coping

cv2.imwrite might be faster ...?

After that, it may be faster with the latest imageio (PIL).

For natural image data, lossless compression does not reduce the storage so much, so it is best to give up compression and use BMP or TIFF (8bit, 16bit, 32bit).

By the way, if you save 16bit PNG with imwrite, it will be automatically set to 8bit if the input image data is in the range of [0, 255] unless you add the PNG-FI option.

Recommended Posts

PNG saving is slow with Python imageio.imwrite
[Python] What is a with statement?
[Python] Visualize and identify slow parts with pytest
Statistics with python
Python with Go
Python log is not output with docker-compose up
Convert svg file to png / ico with Python
Twilio with Python
[Web development with Python] query is also redirect
Integrate with Python
Play with 2016-Python
AES256 with python
Tested with Python
python starts with ()
with syntax (Python)
What are you comparing with Python is and ==?
Bingo with python
Zundokokiyoshi with python
Python is instance
[Web development with Python] Precautions when saving cookies
Excel with Python
Microcomputer with Python
Cast with python
What is Python
Solve AtCoder Beginner Contest159 D --Banned K (ABC159D) with python (count is too slow!)
Procedure to load MNIST with python and output to png
Note that writing like this with ruby is writing like this with python
What is God? Make a simple chatbot with python
Raspberry Pi with Elixir, which is cooler than Python
python int is infinite
Zip, unzip with python
Django 1.11 started with Python3.6
Primality test with Python
Python with eclipse + PyDev.
Scraping with Python (preparation)
Try scraping with Python.
Learning Python with ChemTHEATER 03
Sequential search with Python
"Object-oriented" learning with python
Run Python with VBA
Handling yaml with python
Serial communication with python
Learning Python with ChemTHEATER 05-1
Learn Python with ChemTHEATER
Run prepDE.py with python3
1.1 Getting Started with Python
Collecting tweets with Python
[Python] What is Pipeline ...
Binarization with OpenCV / Python
3. 3. AI programming with Python
Kernel Method with Python
Non-blocking with Python + uWSGI
Scraping with Python + PhantomJS
Posting tweets with python
Python classes are slow
Drive WebDriver with python
Use mecab with Python3
[Python] Redirect with CGIHTTPServer
Voice analysis with python
Think yaml with python
Operate Kinesis with Python