Skip to content

OutOfMemory exception if element is bigger than page #9

@AqueM

Description

@AqueM

var croppedImage = new Rectangle(pixelRatio * element.Location.X, pixelRatio * element.Location.Y, pixelRatio * element.Size.Width, pixelRatio * element.Size.Height); screenshot = screenshot.Clone(croppedImage, screenshot.PixelFormat);

This line will throw a critical exception if the element overflows page, because it is attempting to crop more (element size) than the size of the bitmap (page size). See: https://stackoverflow.com/questions/199468/c-sharp-image-clone-out-of-memory-exception
It might be beneficial to restrict the max size of the crop to bitmap size to avoid this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions