I’m using opencv to crop tif files, everthing is fine, except for saving image to a file – opencv always uses LZW compression, but i don’t need compression on resulting files, i do appreciate opencv’s help in saving my disk drive space, but now is not the right time to do it.
So is there a way to save tif files with specific compression scheme (including no compression) or no?
Original images have no compression scheme applied and i’m using ROI to select area and SaveImage to save it to the target file. Any help appreciated!
The TIFF compression level is hard coded and cant be changed at run time. If you are compiling OpenCV on your machine, then you can edit the compression level in this file
you will find this line:
Hope that helps.
Edit: see this line in the opencv code:
https://github.com/Itseez/opencv/blob/b46719b0931b256ab68d5f833b8fadd83737ddd1/modules/imgcodecs/src/grfmt_tiff.cpp#L564
you should be able to pass the desired value for TIFFTAG_COMPRESSION, including COMPRESSION_NONE.