I found the solution. You have to save after every frame add. Below is the corrected code.
The image used was irrelevant. This was happening for any multi-page tiff.
ParsePageNumbers is posted below. It's a way to take a printer type of formatted number string and create an innumerable integer list. In full disclosure I found the ParsePageNumbers on the internet, don't recall where.
public void GetTiffPages(string origin, string pages)
{
TiffImage destImage = null;
TiffOptions tiffOptions = new TiffOptions(TiffExpectedFormat.TiffCcittFax4)
{
ResolutionSettings = new ResolutionSetting(200, 200),
Photometric = TiffPhotometrics.MinIsWhite
};
//Create an instance of TiffImage and load the copied destination image
using (var image = (TiffImage)Aspose.Imaging.Image.Load(origin))
{
//Create an instance of int to keep track of frames in TiffImage
int pageCount = image.Frames.Length;
var pageList = ParsePageNumbers(pages, 0, pageCount);
foreach (var pg in pageList)
{
//if any of the page numbers are greater than the available frames
if (pg >= pageCount)
{
break;
}
</span><span style="background-color: white; color: rgb(43, 145, 175);">TiffFrame</span><span style="background-color: white;"> tiffFrame = image.Frames[pg - 1];
</span><span style="background-color: white; color: blue;">if</span><span style="background-color: white;"> (destImage == </span><span style="background-color: white; color: blue;">null</span><span style="background-color: white;">)
{
destImage = </span><span style="background-color: white; color: blue;">new</span><span style="background-color: white;"> </span><span style="background-color: white; color: rgb(43, 145, 175);">TiffImage</span><span style="background-color: white;">(</span><span style="background-color: white; color: rgb(43, 145, 175);">TiffFrame</span><span style="background-color: white;">.CopyFrame(tiffFrame));
}
</span><span style="background-color: white; color: blue;">else</span><span style="background-color: white;">
{
destImage.AddFrame(</span><span style="background-color: white; color: rgb(43, 145, 175);">TiffFrame</span><span style="background-color: white;">.CopyFrame(tiffFrame));
}
</span><b style="background-color: rgb(255, 255, 0);">destImage.Save(origin + <span style="color: rgb(163, 21, 21);">".pages"</span>, tiffOptions);</b><span style="background-color: white;">
}
}</span></pre><pre style="font-family: Consolas; font-size: 13px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><pre style="font-family: Consolas; background: white;"><span style="color:green;"> //moves the new selected frames to the original file</span>
if (File.Exists(origin + “.pages”))
{
File.Delete(origin);
File.Move(origin + “.pages”, origin);
}
}
private IEnumerable<Int32> ParsePageNumbers(String s, Int32 firstPage, Int32 lastPage)
{
String[] parts = s.Split(’ ', ‘;’, ‘,’);
Regex reRange = new Regex(@"^\s*((?<from>\d+)|(?<from>\d+)(?<sep>(-|..))(?<to>\d+)|(?<sep>(-|..))(?<to>\d+)|(?<from>\d+)(?<sep>(-|..)))\s*$");
foreach (String part in parts)
{
Match maRange = reRange.Match(part);
if (maRange.Success)
{
Group gFrom = maRange.Groups[“from”];
Group gTo = maRange.Groups[“to”];
Group gSep = maRange.Groups[“sep”];
<span style="color:blue;">if</span> (gSep.Success)
{
<span style="color:#2b91af;">Int32</span> from = firstPage;
<span style="color:#2b91af;">Int32</span> to = lastPage;
<span style="color:blue;">if</span> (gFrom.Success)
from = <span style="color:#2b91af;">Int32</span>.Parse(gFrom.Value);
<span style="color:blue;">if</span> (gTo.Success)
to = <span style="color:#2b91af;">Int32</span>.Parse(gTo.Value);
<span style="color:blue;">for</span> (<span style="color:#2b91af;">Int32</span> page = from; page <= to; page++)
<span style="color:blue;">yield</span> <span style="color:blue;">return</span> page;
}
<span style="color:blue;">else</span>
<span style="color:blue;">yield</span> <span style="color:blue;">return</span> <span style="color:#2b91af;">Int32</span>.Parse(gFrom.Value);
}
}
}