- - PR -
アニメーションGIFの判別
1
投稿者 | 投稿内容 |
---|---|
|
投稿日時: 2006-02-14 01:34
初めて投稿します。宜しくお願いします。
C#でGIFのサイズを変更するアプリケーションを作成しています。アニメーションGIFを処理の対象外とするため、通常のGIFと区別したいのですが、うまくいきません。 下のソースだと、アニメーションGIFも処理してしまいます。(最初の1枚のみ) 良い方法をご教授お願いします。 Bitmap bmp = new Bitmap(e.FullPath); ImageCodecInfo[] decoders = ImageCodecInfo.GetImageDecoders(); foreach (ImageCodecInfo ici in decoders) { if (ici.FormatID == bmp.RawFormat.Guid) { if( ici.FormatDescription == "GIF" ){ // 通常のGIFの場合の処理 } else if( ici.FormatDescription == "JPEG" ){ // JPEGの場合の処理 } } } |
|
投稿日時: 2006-02-14 02:54
System.Drawing.ImageAnimator.CanAnimateメソッドなんかはどうでしょ。 |
|
投稿日時: 2006-02-14 12:13
Hongliang様
うまくいきました! if( ici.FormatDescription == "GIF" ) ↓ if( ici.FormatDescription == "GIF" && !ImageAnimator.CanAnimate(bmp) ) とすることで、あっさり解決しました。 ありがとうございました。 |
1