Format() public méthode

Sets the output format of the current image to the matching T:System.Drawing.Imaging.ImageFormat.
public Format ( ISupportedImageFormat format ) : ImageFactory
format ISupportedImageFormat The . to set the image to.
Résultat ImageFactory
        private string SaveLargeImage(byte[] bytes, string fileName)
        {
            using (MemoryStream inStream = new MemoryStream(bytes))
            {
                using (MemoryStream outStream = new MemoryStream())
                {
                    using (ImageFactory imageFactory = new ImageFactory())
                    {
                        // Load, resize, set the format and quality and save an image.
                        imageFactory.Load(inStream);
                        int width = imageFactory.Image.Size.Width;
                        int height = imageFactory.Image.Size.Height;

                        if (width > 1600)
                        {
                            int newHeight = (int)((1600 / (double)width) * height);
                            imageFactory.Resize(new Size(1600, newHeight));
                            imageFactory.Format(ImageFormat.Jpeg);
                            imageFactory.Quality(80);
                            imageFactory.Save(outStream);
                        }
                        else if (height > 1600)
                        {
                            int newWidth = (int)((1600 / (double)height) * width);
                            imageFactory.Resize(new Size(newWidth, 1600));
                            imageFactory.Format(ImageFormat.Jpeg);
                            imageFactory.Quality(80);
                            imageFactory.Save(outStream);
                        }
                        else
                        {
                            imageFactory.Save(outStream);
                        }
                    }

                    outStream.Position = 0;
                    var resizedResult = this._fileStorage.UploadFile(outStream, fileName, "products/");
                    return resizedResult.Uri.ToString();
                }
            }
        }
        private string SaveThumbnail(byte[] bytes, string fileName)
        {
            using (MemoryStream inStream = new MemoryStream(bytes))
            {
                using (MemoryStream outStream = new MemoryStream())
                {
                    using (ImageFactory imageFactory = new ImageFactory())
                    {
                        // Load, resize, set the format and quality and save an image.
                        imageFactory.Load(inStream);
                        imageFactory.Resize(new Size(200, 0));
                        imageFactory.Format(ImageFormat.Jpeg);
                        imageFactory.Quality(80);
                        imageFactory.Save(outStream);
                    }

                    outStream.Position = 0;
                    var thumbnailResult = this._fileStorage.UploadFile(outStream, "thumb-" + fileName, "products/");
                    return thumbnailResult.Uri.ToString();
                }
            }
        }