I have successfully written images with sizes of about 60000x30000 (1,800,000,000 pixels), but when reading the image with imread, I get an assertion from these defined limits in opencv/modules/imgcodecs/src/loadsave.cpp:
#define CV_IO_MAX_IMAGE_PARAMS (50)
#define CV_IO_MAX_IMAGE_WIDTH (1<<20)
#define CV_IO_MAX_IMAGE_HEIGHT (1<<20)
#define CV_IO_MAX_IMAGE_PIXELS (1<<30) // 1 Gigapixel
I'm wondering if there are specific requirements being met by these or if they're just arbitrarily defined. 1<<20 matches dimensions of 1,000,000, where 1<<16 = 65536 seems to make more sense.
It doesn't make sense to be able to write an image out of a certain size but be unable to read it.