-
-
Notifications
You must be signed in to change notification settings - Fork 56.3k
Closed
Description
System Information
OpenCV python version: 4.7.0.72
Operating System / Platform: Windows 10
Python version: 3.10.10
Detailed description
Writing a signed 32 bit image as a tiff file will not be compressed with LZW. Not by default or when explicitly asked with a flag.
Steps to reproduce
import cv2
import numpy as np
cv2.imwrite('gray8.tiff', np.zeros(shape=(1000,1000), dtype=np.int8), (cv2.IMWRITE_TIFF_COMPRESSION, 5)) # 5 is LZW compression
cv2.imwrite('gray32.tiff', np.zeros(shape=(1000,1000), dtype=np.int32), (cv2.IMWRITE_TIFF_COMPRESSION, 5)) # 5 is LZW compression
Checking the files afterwards, 'gray8.tiff' is compressed with LZW, while 'gray32.tiff' isn't
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files (videos, images, onnx, etc)