I'm using gdi+ to get animated gif loop count, when I test the code with gifs made by myself, I found the count is always 1 less than it actually is as played in IE11 and Chrome,
except I set the loop count as 1, it will be 1, it's right,
if I set the loop count as 2,3, and so on, the code get it as 1,2, and so on.
Although the gifs with loop count 1 and 2 are played correctly in IE11 and Chrome, the code get the same value as 1.
I can't guess if there is anything in gif file expresses it will repeat or not.
After I use command tool gifsicle to list the gif infomation, I found the difference of the loop count 1 and 2 gifs, the loop count 2 gif has a line
loop count 1
while loop count 1 gif has not.
But I don't know what's the code of gdi+ to distinguish the difference.
This is the code:
// new Bitmap
m_pBitmap = new Bitmap(szFilePath);
// get loop count
PropertyItem* pPropLoopCount;
UINT uSize = m_pBitmap->GetPropertyItemSize(PropertyTagLoopCount);
PropertyItem* pPropertyItem = (PropertyItem*)new char[uSize];
Status status = m_pBitmap->GetPropertyItem(PropertyTagLoopCount, uSize, pPropertyItem);
if (Status::Ok != status)
return false;
m_sLoopCount = *((SHORT*)pPropLoopCount->value);
document of MSDN just said:
For an animated GIF image, the number of times to display the animation. A value of 0 specifies that the animation should be displayed infinitely.
about PropertyTagLoopCount.
After all, two questions:
- Is loop count the code got means actual play times minus 1?
- What's the code of gdi+ to distinguish actual loop count 1 and 2 gifs?