You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request opencv#26971 from Kumataro:fix26970
imgcodecs: gif: support animated gif without loop opencv#26971Closeopencv#26970
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
Copy file name to clipboardExpand all lines: modules/imgcodecs/include/opencv2/imgcodecs.hpp
+12-2Lines changed: 12 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -118,8 +118,8 @@ enum ImwriteFlags {
118
118
IMWRITE_JPEGXL_EFFORT = 641,//!< For JPEG XL, encoder effort/speed level without affecting decoding speed; it is between 1 (fastest) and 10 (slowest). Default is 7.
119
119
IMWRITE_JPEGXL_DISTANCE = 642,//!< For JPEG XL, distance level for lossy compression: target max butteraugli distance, lower = higher quality, 0 = lossless; range: 0 .. 25. Default is 1.
120
120
IMWRITE_JPEGXL_DECODING_SPEED = 643,//!< For JPEG XL, decoding speed tier for the provided options; minimum is 0 (slowest to decode, best quality/density), and maximum is 4 (fastest to decode, at the cost of some quality/density). Default is 0.
121
-
IMWRITE_GIF_LOOP = 1024,//!< For GIF, it can be a loop flag from 0 to 65535. Default is 0 - loop forever.
122
-
IMWRITE_GIF_SPEED = 1025,//!< For GIF, it is between 1 (slowest) and 100 (fastest). Default is 96.
121
+
IMWRITE_GIF_LOOP = 1024,//!< Not functional since 4.12.0. Replaced by cv::Animation::loop_count.
122
+
IMWRITE_GIF_SPEED = 1025,//!< Not functional since 4.12.0. Replaced by cv::Animation::durations.
123
123
IMWRITE_GIF_QUALITY = 1026, //!< For GIF, it can be a quality from 1 to 8. Default is 2. See cv::ImwriteGifCompressionFlags.
124
124
IMWRITE_GIF_DITHER = 1027, //!< For GIF, it can be a quality from -1(most dither) to 3(no dither). Default is 0.
125
125
IMWRITE_GIF_TRANSPARENCY = 1028, //!< For GIF, the alpha channel lower than this will be set to transparent. Default is 1.
@@ -260,10 +260,20 @@ It provides support for looping, background color settings, frame timing, and fr
260
260
structCV_EXPORTS_W_SIMPLE Animation
261
261
{
262
262
//! Number of times the animation should loop. 0 means infinite looping.
263
+
/*! @note At some file format, when N is set, whether it is displayed N or N+1 times depends on the implementation of the user application. This loop times behaviour has not been documented clearly.
264
+
* - (GIF) See https://issues.chromium.org/issues/40459899
265
+
* And animated GIF with loop is extended with the Netscape Application Block(NAB), which it not a part of GIF89a specification. See https://en.wikipedia.org/wiki/GIF#Animated_GIF .
266
+
* - (WebP) See https://issues.chromium.org/issues/41276895
267
+
*/
263
268
CV_PROP_RW int loop_count;
264
269
//! Background color of the animation in BGRA format.
265
270
CV_PROP_RW Scalar bgcolor;
266
271
//! Duration for each frame in milliseconds.
272
+
/*! @note (GIF) Due to file format limitation
273
+
* - Durations must be multiples of 10 milliseconds. Any provided value will be rounded down to the nearest 10ms (e.g., 88ms → 80ms).
274
+
* - 0ms(or smaller than expected in user application) duration may cause undefined behavior, e.g. it is handled with default duration.
275
+
* - Over 65535 * 10 milliseconds duration is not supported.
276
+
*/
267
277
CV_PROP_RW std::vector<int> durations;
268
278
//! Vector of frames, where each Mat represents a single frame.
0 commit comments