Well, having it to fail in alike cases is the exact point of checking for all kind of return values that I’ve tried to stress at the end of my previous message…
The original image has photometric value of PHOTOMETRIC_RGB, as you could verify say by running tiffinfo utility on the downloaded file - here is the tiffinfo output:
TIFF Directory at offset 0xc0008 (786440)
Subfile Type: (0 = 0x0)
Image Width: 512 Image Length: 512
Bits/Sample: 8
Compression Scheme: None
Photometric Interpretation: RGB color
Samples/Pixel: 3
Planar Configuration: single image plane
However, the original image is 512x512, and you mentioned 8601x7561 resolution in your first post, which means someone scaled the original image, and photometric probably changed along the way. Thus, you’d have either to re-scale the original image, with better control over the output options so that you could match input format expected by my code, or you should change my code in order to match actual format of the image you are intending to process. In any case: TIFF is rather complex format, with many options available, and you’d have to decide pretty much tightly over most of the input format options that your program is accepting (just like my code is doing) and then convert your test image(s) into that exact format, or otherwise your host/device code is going to be very complex in order to work properly. But I’d certainly first suggest you download the original image first, and try with it, and then try to get your kernel working with the original image too, and then you could re-size the image, and try how your kernel behaves with big images.