I'm using the following code to create single tiff file from a list of images using MagickImage.NET Library:
/// <summary>
/// Create single tiff file from a list of base64String images
/// </summary>
/// <param name="pages">A list of base64String images</param>
/// <returns>Byte array of the created tiff file</returns>
public static byte[] CreateSingleTiff(List<string> pages)
{
MagickImage pageImage;
using (MemoryStream byteStream = new MemoryStream())
{
using (MagickImageCollection imagecoll = new MagickImageCollection())
{
for (int i = 0; i < pages.Count; i++)
{
byte[] newBytes = Convert.FromBase64String(pages[i].Replace("data:image/Jpeg;base64,", ""));
pageImage = new MagickImage(newBytes);
imagecoll.Add(pageImage);
}
return imagecoll.ToByteArray();//The problem occurs right here
}
}
}
But I'm getting the first page only!.
Here is the line I used to write the image on disk:
Image.FromStream(new MemoryStream(result)).Save(path, System.Drawing.Imaging.ImageFormat.Tiff);
I tried to dig stackoverflow for something similar but I had no luck. Apparently there is no good support for MagickImage.NET Library. If you see this method is useless what are the other available methods beside this and this one