public void Save(Stream stream, ImageFormat format) { if (format == null) { throw new ArgumentNullException("format"); } ImageCodecInfo encoder = format.FindEncoder(); this.Save(stream, encoder, null); }
/// <summary> /// Saves this <see cref='Image'/> to the specified stream in the specified format. /// </summary> public void Save(Stream stream, ImageFormat format) { if (format == null) { throw new ArgumentNullException(nameof(format)); } ImageCodecInfo codec = format.FindEncoder(); Save(stream, codec, null); }
public void Save(string filename, ImageFormat format) { if (format == null) { throw new ArgumentNullException("format"); } ImageCodecInfo encoder = format.FindEncoder(); if (encoder == null) { encoder = ImageFormat.Png.FindEncoder(); } this.Save(filename, encoder, null); }
internal void Save(MemoryStream stream) { // Jpeg loses data, so we don't want to use it to serialize... ImageFormat dest = RawFormat; if (dest == ImageFormat.Jpeg) { dest = ImageFormat.Png; } // If we don't find an Encoder (for things like Icon), we just switch back to PNG... ImageCodecInfo codec = dest.FindEncoder() ?? ImageFormat.Png.FindEncoder(); Save(stream, codec, null); }
/// <summary> /// Saves this <see cref='Image'/> to the specified file in the specified format. /// </summary> public void Save(string filename, ImageFormat format) { if (format == null) { throw new ArgumentNullException("format"); } ImageCodecInfo codec = format.FindEncoder(); if (codec == null) { codec = ImageFormat.Png.FindEncoder(); } Save(filename, codec, null); }
internal void Save(MemoryStream stream) { ImageFormat rawFormat = this.RawFormat; if (rawFormat == ImageFormat.Jpeg) { rawFormat = ImageFormat.Png; } ImageCodecInfo encoder = rawFormat.FindEncoder(); if (encoder == null) { encoder = ImageFormat.Png.FindEncoder(); } this.Save(stream, encoder, null); }