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

Support for composite multiple images #73

Closed
vntrungld opened this issue Sep 12, 2022 · 5 comments
Closed

Support for composite multiple images #73

vntrungld opened this issue Sep 12, 2022 · 5 comments
Labels
Milestone

Comments

@vntrungld
Copy link

vntrungld commented Sep 12, 2022

How to composite multiple images by a single command? I'm making a PHP SDK for Sharp using this project so maybe we need a solution for composite multiple images like Imagick.

@vseventer
Copy link
Owner

Can you show me what you tried? Although I have not tried this, you should be able to compose multiple images using something like sharp composite <image1> -- composite <image2>.

@vntrungld
Copy link
Author

vntrungld commented Sep 20, 2022

Hi @vseventer, sorry for the late response
The command I've tried is:

sharp -i background-min.png -o result-min.png -f png -- composite face-min.png --gravity southeast -- composite flower-min.png --gravity southeast

I tried to put face and flower on the background but the result only have flower and background. Look like the command only takes the latest composite image
background-min
face-min
flower-min
result-min

@vseventer
Copy link
Owner

vseventer commented Sep 20, 2022

Thanks for providing this - while Sharp allows compositing multiple images, the CLI is not passing the images in the right format.

Since this likely affects other operations too, I got to dig a bit deeper and figure out a pattern that works for all affected areas.

@vseventer vseventer added the bug label Sep 20, 2022
@vseventer vseventer added this to the v3.1.0 milestone Sep 20, 2022
@vseventer vseventer modified the milestones: v3.1.0, v4.0.0 Dec 9, 2022
@vseventer
Copy link
Owner

Fixed in #75 - hoping to complete that PR soon and release a new major version.

In your case, usage will be:

sharp -i background-min.png -o result-min.png -f png composite face-min.png flower-min.png --gravity southeast

@vseventer
Copy link
Owner

Fixed in v4.0.0, now available.

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

No branches or pull requests

2 participants