Skip to content

Conversation

dougg0k
Copy link

@dougg0k dougg0k commented Jun 29, 2025

Hey,

I tried to quickly replace sharp with the library I suggested in #713 (comment)

But they seem to be lacking compositing support.

I opened a PR with the progress, but feel free to close it, if you prefer do yourself or for whatever reason.

I requested that they add compositing support, but not sure if they will or when. Brooooooklyn/Image#138

@dougg0k dougg0k requested a review from zoontek as a code owner June 29, 2025 20:49
@zoontek
Copy link
Owner

zoontek commented Jun 30, 2025

@dougg0k Can you put this in Draft?

@dougg0k dougg0k marked this pull request as draft June 30, 2025 13:45
@dougg0k
Copy link
Author

dougg0k commented Jun 30, 2025

I found a canvas alternative, but not sure this would work. I will leave the testing and finalization to you. @zoontek

https://github.com/Brooooooklyn/canvas

git fetch origin pull/715/head:replace-sharp
git switch replace-sharp

# or

gh pr checkout 715

@dougg0k dougg0k marked this pull request as ready for review July 1, 2025 20:05
@dougg0k
Copy link
Author

dougg0k commented Jul 21, 2025

Ideally there should be a way to test / have tests written to check the svg generated are properly implemented, but there isnt.

What is the recommended way to run and test it through the dist generated folder?

@zoontek
Copy link
Owner

zoontek commented Sep 27, 2025

@dougg0k I currently don't have the personal time to take a look at this, will do as soon as I can.

EDIT: Just had a quick check on sharp repository, it appears that libvips is shipped compiled, as a sharp transitive dependency, and so to use sharp you must only comply to the Apache 2 license, not LGPL v3 (source). I will dig deeper when I have a bit of time.

@dougg0k
Copy link
Author

dougg0k commented Sep 27, 2025

@zoontek Ok, I meant mostly to have something to test / check if the svg being generated would be correct, any way to test that?

That would easily help make sure with any implementation, that it works.

@zoontek
Copy link
Owner

zoontek commented Sep 27, 2025

@dougg0k Quickly tested it, I had to replace all new Transformer with Transformer.fromSvg to make it works (the image wasn't recongnized), and it doesn't work properly:

Screenshot 2025-09-27 at 12 18 14

To test it, do a yarn reinstall in the example app, then node ../cli.js generate svgs/light-logo.svg …

@dougg0k
Copy link
Author

dougg0k commented Sep 28, 2025

I found the reasons for bad metadata and not generating images in android, they are now fixed.

But the only issue still remains, which is that one you showed through the image. For whatever reason with svg, their resize or fastResize, results in the same.

@dougg0k
Copy link
Author

dougg0k commented Sep 28, 2025

@zoontek

Want to test, now? Seems to be working.

https://github.com/Brooooooklyn/Image
https://github.com/Brooooooklyn/canvas
https://github.com/thx/resvg-js

All built using napi-rs.

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