public IImageFormat DetectFormat(Stream stream) { var internalFormat = Image.DetectFormat(stream); if (internalFormat != null) { return(ImageSharpUtility.CreateFormat(internalFormat)); } return(null); }
public async Task <IImageFormat> DetectFormatAsync(Stream stream) { var internalFormat = await Image.DetectFormatAsync(stream); if (internalFormat != null) { return(ImageSharpUtility.CreateFormat(internalFormat)); } return(null); }
public IImageFormat FindFormatByExtension(string extension) { var internalFormat = FindInternalImageFormat(extension); if (internalFormat != null) { return(ImageSharpUtility.CreateFormat(internalFormat)); } return(null); }
public override IImageEncoder CreateEncoder() { if (QuantizationMethod != null || ColorTableMode != null) { return(new GifEncoder { ColorTableMode = (SharpGifColorTableMode?)ColorTableMode, Quantizer = ImageSharpUtility.CreateQuantizer(QuantizationMethod) }); } return(base.CreateEncoder()); }
public override IImageEncoder CreateEncoder() { if (BitDepth != null || ColorType != null || CompressionLevel != null || Gamma != null || Threshold != null || QuantizationMethod != null || InterlaceMode != null || ChunkFilter != null || TransparentColorMode != null || IgnoreMetadata) { var encoder = new PngEncoder { BitDepth = (SharpPngBitDepth?)BitDepth, ColorType = (SharpPngColorType?)ColorType, Gamma = Gamma, InterlaceMethod = (SharpPngInterlaceMode?)InterlaceMode, ChunkFilter = (SharpPngChunkFilter?)ChunkFilter, Quantizer = ImageSharpUtility.CreateQuantizer(QuantizationMethod), IgnoreMetadata = IgnoreMetadata }; if (TransparentColorMode != null) { encoder.TransparentColorMode = (SharpPngTransparentColorMode)TransparentColorMode.Value; } if (CompressionLevel != null) { encoder.CompressionLevel = (SharpPngCompressionLevel)CompressionLevel; } if (Threshold != null) { encoder.Threshold = Threshold.Value; } return(encoder); } return(base.CreateEncoder()); }
public SharpImage(Image image, SharpFormat sharpFormat) : this(image, ImageSharpUtility.CreateFormat(sharpFormat)) { }
public SharpImageInfo(SixLabors.ImageSharp.IImageInfo info, SixLabors.ImageSharp.Formats.IImageFormat format) { _info = info; _format = ImageSharpUtility.CreateFormat(format); }