Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KalikoImage constructor throws OutOfMemoryException when loading TIFF file #12

Open
GoogleCodeExporter opened this issue Oct 23, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. instantiate KalikoImage by passing TIFF file name

What is the expected output? What do you see instead?
Expected: image is instantiated properly
Actual: OutOfMemoryException is thrown


What version of the product are you using? On what operating system?
1.2.4.0 (Win7)

Please provide any additional information below.

This happens for some TIFF images (especially when they are about 1500x1500). 
What we have noticed it is related to some kind of unsupported format of image.

There is also a workaround for it. If conversion used in MakeImageNonIndexed() 
method is always executed, file is loaded properly:
private void MakeImageNonIndexed()
{
  //if(IndexedPalette)
    _image = new Bitmap(new Bitmap(_image));            
}

You can contact me at wojciech.kotlarski at 7digital.com in order to get 
example tiff file that is causing problems (I cannot upload this image with 
this ticket, as it should not be publicly available)

Original issue reported on code.google.com by [email protected] on 25 Feb 2013 at 2:51

@GoogleCodeExporter
Copy link
Author

Hello,

There is a working code for us (change is applied to KalikoImage.cs):

public void LoadImage(string fileName)
{
    _image = ConvertImage(Image.FromFile(fileName));
    _g = Graphics.FromImage(_image);
}

public void LoadImage(Stream stream)
{
    _image = ConvertImage(Image.FromStream(stream));
    _g = Graphics.FromImage(_image);
}

/// <summary>
/// Convert image to truecolor
/// </summary>
private Image ConvertImage(Image image)
{
    using (image)
    using (Bitmap bitmap = new Bitmap(image))
        return new Bitmap(bitmap);
}

Original comment by [email protected] on 25 Feb 2013 at 5:02

@GoogleCodeExporter
Copy link
Author

Original comment by [email protected] on 25 Feb 2013 at 8:30

  • Changed state: Accepted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant