Skip to content

Conversation

Marv51
Copy link
Contributor

@Marv51 Marv51 commented May 13, 2022

If you already have a loaded ImageSharp image (maybe to apply some effects) this image currently cannot be supplied to PdfSharp Core. Instead the image needs to be encoded to a byte array and this can then be used to create an ImageSource (decoding it to a ImageSharp image again).

This pull-request enables the user to supply a ImageSharp image directly, without encoding and decoding it. This should be an obvious performance win. (I did not create any formal benchmarks)

It is not super straight forward how to use this, because I wanted to change as little code as possible, but I added a test that shows how to use this feature. I didn't add a convenience method to ImageSource or XImage to keep those independent of ImageSharp.

I hope people will find this useful and look forward to your feedback.

(This PR also runs the tests under .Net 6.0 as .Net 5.0 is EOL now.)

@ststeiger ststeiger merged commit c0cd985 into ststeiger:master May 25, 2022
@ststeiger
Copy link
Owner

Merged.

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

Successfully merging this pull request may close these issues.

2 participants