-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
questionFurther information is requestedFurther information is requested
Description
Describe the question.
Hello, thank you for viewing this question. I need to create some TIFF files with JPEG or JPEG2000 compression. After learning about nvImageCodec, I tried to study it. However, I couldn't find suitable answers in the official documentation at https://docs.nvidia.com/cuda/nvimagecodec/samples/python_samples.html and https://docs.nvidia.com/cuda/nvimagecodec/py_api.html . Since I don't know how to write C or C++ code, I came here to ask. Thank you for your help.
Here is my Python code snippet:
import numpy as np
from nvidia import nvimgcodec
tif_file = r"HH_2.tiff"
# The image is 8-bit with 3 channels.
decodeparams = nvimgcodec.DecodeParams(allow_any_depth=True)
decoder = nvimgcodec.Decoder()
nv_img_0 = decoder.decode(tif_file, params=decodeparams)
img_0 = np.array(nv_img_0.cpu())
encoder = nvimgcodec.Encoder()
codec = 'tiff'
encode_params_0 = nvimgcodec.EncodeParams(quality_type=nvimgcodec.QualityType.LOSSLESS)
encoder.write("HH_nv.tiff", img_0, codec, params=encode_params_0)
# It outputs an uncompressed TIFF image.
encode_params_1 = nvimgcodec.EncodeParams(quality_value=1)
encoder.write("HH_LZW_nv.tiff", img_0, codec, params=encode_params_1)
# The output is a TIFF image compressed with LZW.Check for duplicates
- I have searched the open bugs/issues and have found no duplicates for this bug report
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested