示例#1
0
        public static ImageInfo?Info(Stream stream)
        {
            var decoder = new PngDecoder(stream);
            var r       = decoder.stbi__parse_png_file(STBI__SCAN_header, 0);

            stream.Rewind();

            if (r == 0)
            {
                return(null);
            }

            return(new ImageInfo
            {
                Width = decoder.img_x,
                Height = decoder.img_y,
                ColorComponents = (ColorComponents)decoder.img_n,
                BitsPerChannel = decoder.depth
            });
        }
示例#2
0
        public static ImageResult Decode(Stream stream, ColorComponents?requiredComponents = null)
        {
            var decoder = new PngDecoder(stream);

            return(decoder.InternalDecode(requiredComponents));
        }