コード例 #1
0
ファイル: AnimatedGif.cs プロジェクト: drasticactions/Gifed
        /// <summary>
        ///     Loads an existing GIF image from the specified file.
        /// </summary>
        /// <param name="path">A full or relative path an image on disk.</param>
        /// <returns>A new instance of <see cref="AnimatedGif" /> representing the file.</returns>
        /// <exception cref="InvalidOperationException">Thrown if the file does not contain data for an animated GIF image.</exception>
        public static AnimatedGif LoadFrom(string path)
        {
            var image = Image.FromFile(path);

            return(AnimatedGif.LoadFrames(image));
        }
コード例 #2
0
ファイル: AnimatedGif.cs プロジェクト: drasticactions/Gifed
        /// <summary>
        ///     Loads an existing GIF image from the specified stream.
        /// </summary>
        /// <param name="stream">A readable stream containing image data.</param>
        /// <returns>A new instance of <see cref="AnimatedGif" /> representing the stream.</returns>
        /// <exception cref="InvalidOperationException">Thrown if the stream does not contain data for an animated GIF image.</exception>
        /// <exception cref="IOException">Thrown when an I/O error occurs.</exception>
        /// <exception cref="NotSupportedException">The stream does not support reading.</exception>
        public static AnimatedGif LoadFrom(Stream stream)
        {
            var image = Image.FromStream(stream);

            return(AnimatedGif.LoadFrames(image));
        }