We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert .bmp to tiff add to multipage tiff without writing to disk

What I am trying to accomplish:

Read in 2 .bmp files
Convert these two .bmp files to .tiff files and save to individual memory streams
Take both memory streams and create one multi page tiff memorystream

Please let me know if there is a better way of doing this (preferably all within memory and not writing out to disk). This method is not currently working.

public void CreateMultipageTiffMemoryStream(ref MemoryStream memoryStream)
string front = @“C:\temp\front.bmp”;
string back = @“C:\temp\back.bmp”;

TiffOptions tiffOptions = new TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.TiffCcittFax4);

MemoryStream memoryStream1 = new MemoryStream();
using(Image image1 = Image.Load(front))
image1.Save(memoryStream1, tiffOptions);

MemoryStream memoryStream2 = new MemoryStream();
using(Image image2 = Image.Load(back))
image2.Save(memoryStream2, tiffOptions);

using (TiffImage tiff1 = (TiffImage)TiffImage.Load(memoryStream1))
using(TiffImage tiff2 = (TiffImage)TiffImage.Load(memoryStream2))
TiffFrame frame = TiffFrame.CopyFrame(tiff2.ActiveFrame);


Hi Brent,

Thank you for your inquiry and providing sample code.

Please use the following code snippet to add different images as separate frames in a multi page TIFF image. This code snippet iterate through a folder that contain images. The image count could be two or more and folder can contain PNG, JPG, BMP or JPEG images. For details please access the link:


//Create an instance of TiffOptions with CCITTFAX3 compression
TiffOptions outputSettings = new TiffOptions(TiffExpectedFormat.TiffCcittFax4);
//Set source for the result
outputSettings.Source = new Aspose.Imaging.Sources.StreamSource(new MemoryStream());
//Declare Height and Width for the new TiffImage
int newWidth = 500;
int newHeight = 500;
string path = "output.tiff";
//Create an instance of TiffImage using the object of TiffOptions and dimension
using (TiffImage tiffImage = (TiffImage)Aspose.Imaging.Image.Create(outputSettings, newWidth, newHeight))
//Initialize a variable to keep track of frames in the TiffImage
int index = 0;
//Read all JPG files from any specified directory and iterate over the list
foreach (var file in Directory.GetFiles("someFolder\\", "*.jpg"))
//Load the image into an instance of RasterImage
using (RasterImage ri = (RasterImage)Aspose.Imaging.Image.Load(file))
//Resize the image according to TiffImage dimensions
ri.Resize(newWidth, newHeight, ResizeType.NearestNeighbourResample);
//Get the active frame of TiffImage
TiffFrame frame = tiffImage.ActiveFrame;
//Check if TiffImage already has a frame
if (index > 0)
//Create a new TiffFrame according to the TiffOptions settings
frame = new TiffFrame(
new TiffOptions(outputSettings) /*ensure options are cloned for each frame*/,
// If there is a TIFF image loaded, you need to enumerate the frames and perform the following
// frame = TiffFrame.CreateFrameFrom(sourceFrame, outputSettings);

//Save the RasterImage data onto TiffFrame
frame.SavePixels(frame.Bounds, ri.LoadPixels(ri.Bounds));
if (index > 0)
//Add the newly created frame to the TiffImage
//Save the changes to TiffImage

Hope the above information helps. Feel free to contact us in case you have further query or comments.

Thank you for your response. I have tried this however all of the tiff frames are black when they are saved. Do you know why this would be the case? I have tried *.jpg and *.bmp (images are there and seem fine). I am using the nuget package right now (unlicensed) for testing, could that have anything to do with it?

Okay, looks like it was a license issue. I applied a temporary license and it seems to fix the issue. The only thing that was rendering on the tiff frames was the “Evaluation only…” image. This may be something that should be addressed for future potential clients.

Hi Brent,

Thank you for update.

It is good to know that the issue you are facing has been resolved. Please feel free to reach us in case you have any query or comments.