question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enhancement: composite with negative values for top and/or left

See original GitHub issue

Hello!

Is there a reason why negative values are not supported with top and left from within overlayWith? I am not familiar with how libvips work as well, so feel free to close this if this is something that is specifically not supported.

A use case for this is composing coordinate-based map images (such as a radar image on top of a static base map).

For example, a base map could be cropped like this:

screen shot 2018-03-16 at 9 27 24 am

The square outlines for this base map indicates the position of a 256x256 tile image. From this information, we can calculate the pixel position of where tile should go and place them where they belong. So the first tile could be at x:-44,y:-102, second would be x:212,y:-102, and so on.

Please let me know if I missed something from the docs or this isn’t something that is supported.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
lovellcommented, Mar 16, 2018

sharp currently contains its own alpha blending logic, which will extend an overlay to match the dimensions of the image underneath before blending.

“The overlay image must be the same size or smaller than the processed image.” http://sharp.pixelplumbing.com/en/stable/api-composite/#overlaywith

The work for #728 will involving the replacement of some of sharp’s alpha blending logic with libvips’ new composite operation. That task will probably be quite disruptive to the image compositing logic so I would recommend we wait for that before thinking about how to support overlays positioned (partly) outside the dimensions of the image underneath.

I can definitely see the usefulness of this feature so thank you for suggesting it!

0reactions
lovellcommented, Dec 22, 2020

v0.27.0 is now available, thank you for the PRs to improve this feature!

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Definitive Guide to Using Negative Margins
When a static element is given a negative margin on the top/left, it pulls the element in that specified direction. For example:
Read more >
Large optical nonlinearity enhancement under electronic ...
The negative and positive values of β indicate saturable absorption and reverse saturable absorption, respectively, as detailed in Supplementary ...
Read more >
Left atrial deformation: Useful index for early detection ... - NCBI
Left atrial (LA) enlargement is part of cardiac remodeling observed in various cardiovascular diseases and appears to be associated with poor ...
Read more >
How do negative margins in CSS work and why is (margin-top
Negative margins are valid in css and understanding their (compliant) behaviour is mainly based on the box model and margin collapsing.
Read more >
Investigation the conductivity of carbon fiber composites ...
Research has shown that carbon fiber composites are thermally conductive. The thermal characterization has the highest value of thermal conductivity per/the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found