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

Free Support Forum - aspose.com

Error on use copied TiffFrame

Hi.
We use TiffFrame.CopyFrame method to join several tiff to one tiff.
It was working with Aspose.Imaging v19.11 and not working with new versions.
When we call TiffImage.Save (the last line in example) error “Internal buffer is empty” occurs.

Example:

private static void BufferError()
{
  const string filename = "in.tiff";
  TiffFrame copiedFrame;

  // prepare test data
  using (var image = new TiffImage(new TiffFrame(new TiffOptions(TiffExpectedFormat.Default), 100, 100)))
    image.Save(filename);

  // do test
  using (var image = (TiffImage)Image.Load(filename))
  {
    copiedFrame = TiffFrame.CopyFrame(image.Frames[0]);
    copiedFrame.CacheData();
  }
  // error internal buffer is empty
  new TiffImage(copiedFrame).Save("out.tiff");
}

@aledyad

Have you tried using the latest version on your end? I request you to please share the source files and output generated on your end along with desired output.

Yes I tried.
Source files and output in attachments.
TiffFrameCopyFrame.zip (3.1 KB)

@aledyad

I have been able to reproduce the issue on my end. A ticket with ID IMAGINGNET-4724 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

Any news regarding this bug?

@Marcin_Lis

I regret to share that at present the issue is still unresolved. We request for your patience and will share the feedback with you as soon as it will be fixed.

I can add that problem occurs when “source” is disposed (stream, image, etc…).

In this example when you perform Save inside last using block (var image…) all is fine.

@Marcin_Lis

Can you please try using following sample code as you need to save inside using block.

private static void BufferError()
{
  const string filename = "in.tiff";
  TiffFrame copiedFrame;

  // prepare test data
  using (var image = new TiffImage(new TiffFrame(new TiffOptions(TiffExpectedFormat.Default), 100, 100)))
    image.Save(filename);

  // do test
  using (var image = (TiffImage)Image.Load(filename))
  {
    copiedFrame = TiffFrame.CopyFrame(image.Frames[0]);
    copiedFrame.CacheData();
    new TiffImage(copiedFrame).Save("out.tiff");
  }
 }