Exemplo n.º 1
0
        public void Identify_DetectsCorrectEncoding(string imagePath, PbmEncoding expectedEncoding)
        {
            var testFile = TestFile.Create(imagePath);

            using var stream = new MemoryStream(testFile.Bytes, false);
            IImageInfo imageInfo = Image.Identify(stream);

            Assert.NotNull(imageInfo);
            PbmMetadata bitmapMetadata = imageInfo.Metadata.GetPbmMetadata();

            Assert.NotNull(bitmapMetadata);
            Assert.Equal(expectedEncoding, bitmapMetadata.Encoding);
        }
Exemplo n.º 2
0
        private void DeduceOptions <TPixel>(Image <TPixel> image)
            where TPixel : unmanaged, IPixel <TPixel>
        {
            this.configuration = image.GetConfiguration();
            PbmMetadata metadata = image.Metadata.GetPbmMetadata();

            this.encoding  = this.options.Encoding ?? metadata.Encoding;
            this.colorType = this.options.ColorType ?? metadata.ColorType;
            if (this.colorType != PbmColorType.BlackAndWhite)
            {
                this.componentType = this.options.ComponentType ?? metadata.ComponentType;
            }
            else
            {
                this.componentType = PbmComponentType.Bit;
            }
        }