Animated gif with different time durations

I have an array of width * height images in cv::Mat pmat[nimages] and an array unsigned int pdurations[nimages]for their respective time duration in milliseconds (from 15ms to 3000ms). I would like to create an animated gif from that, is it possible to create animated gif with images that don’t have the same duration, please?

you’re wrong here.
this is not a computer-vision problem, and opencv neither reads nor writes gif.

OK thanks for your quick answer

you could use ffmpeg or PyAV or imageio for this.

Thank you very much for your answer, I did it using giflib.