Thanks to visit codestin.com
Credit goes to github.com

Skip to content

signed 32bit tiff file writing with compression #23416

@Kroppeb

Description

@Kroppeb

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)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions