// This code is part of GrapeCity Documents for Imaging samples.
// Copyright (c) GrapeCity, Inc. All rights reserved.
using System;
using System.IO;
using System.Drawing;
using System.Collections.Generic;
using System.Linq;
using GrapeCity.Documents.Drawing;
using GrapeCity.Documents.Text;
using GrapeCity.Documents.Imaging;

namespace GcImagingWeb.Samples
    // This sample loads several JPEG images and combines them
    // into a single multi-frame TIFF.
    public class MakeTiff
        public Stream GenerateImageStream(ImageEncoding targetEncoding, Size pixelSize, float dpi, bool opaque, string[] sampleParams = null)
            if (targetEncoding != ImageEncoding.Tiff)
                throw new Exception("This sample only supports TIFF output format.");

            var sources = new string[]
                Path.Combine("Resources", "Images", "colosseum.jpg"),
                Path.Combine("Resources", "Images", "lady.jpg"),
                Path.Combine("Resources", "Images", "minerva.jpg"),
                Path.Combine("Resources", "Images", "forum.jpg"),

            var ms = new MemoryStream();
            using (var tw = new GcTiffWriter(ms))
                foreach (var src in sources)
                    using (var bmp = new GcBitmap(src))
            ms.Seek(0, SeekOrigin.Begin);
            return ms;

        public ImageEncoding DefaultEncoding { get => ImageEncoding.Tiff; }