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

Is it possible to create a tile 2x2 mosaic? #3138

Closed
Simoneth opened this issue Mar 15, 2022 · 4 comments
Closed

Is it possible to create a tile 2x2 mosaic? #3138

Simoneth opened this issue Mar 15, 2022 · 4 comments
Labels

Comments

@Simoneth
Copy link

Question about an existing feature

Tile

What are you trying to achieve?

I need to make a mosaic 2x2 from an array of 4 images...this is for a Lambda Function.
https://stackoverflow.com/questions/71436457/is-it-possible-to-create-a-tile-2x2-mosaic-using-sharp-node

When you searched for similar issues, what did you find that might be related?

I found only this one: https://stackoverflow.com/questions/66698647/sharp-composite-tiling-center

Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this question

In Image Magick I do this:
montage -density 300 -tile 2x0 -geometry 150x150^ -gravity center -crop 150x150+0+0 -border 0 '.$img_array.' /var/www/html/uploads/output.jpg

instead in Sharp I'm able to do only this:

const sharpImage = sharp({
  create: {
    width,
    height,
    channels: 4,
    background: { r: 0, g: 0, b: 0 }
  }
}).composite([{ input: image, tile: true, gravity: 'center' }]).png

That produce a 2x2 mosaic of the same image.

Please provide sample image(s) that help explain this question

https://i.stack.imgur.com/1i72U.jpg

@lovell
Copy link
Owner

lovell commented Mar 15, 2022

Please see #1580 - please can you update your Stack Overflow question with this info too.

(As an aside, props for including the cover of Weiss' Feel My Needs in your sample image 👍 )

@Simoneth
Copy link
Author

Hi,
I need this for a Lambda function, so I'm a bit lost at the moment...from your answer it looks like I have to use libvips library because there's no "join" API for Sharp yet.

The problem with this solution is that it can't be developed in Lambda...or am I missing something?
Thanks!

@Simoneth Simoneth reopened this Mar 17, 2022
@lovell
Copy link
Owner

lovell commented Mar 17, 2022

#1580 is a future possible enhancement with some suggested alternative approaches for now. For example, did you see #1580 (comment) ? Let's continue to track this at #1580.

@lovell lovell closed this as completed Mar 17, 2022
@Simoneth
Copy link
Author

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