Enhancement: return xoffset/yoffset when creating text image
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- JavaScript
- Stars
- 32.7k
- Forks
- 1.4k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 5
Description
Feature request
What are you trying to achieve?
I'm trying to align multiple texts at their baselines. Some cursory experimentation with pyvips suggests that it might be possible to do this if yoffset was available.
In sharp it is not:
let sharp = require('sharp');
(async function () {
let image = sharp({
text: {
text: 'Hello'
}
});
console.log(await image.metadata());
})();
{
format: 'raw',
width: 30,
height: 10,
space: 'b-w',
channels: 1,
depth: 'uchar',
density: 72,
isProgressive: false,
hasProfile: false,
hasAlpha: false
}
When you searched for similar feature requests, what did you find that might be related?
"yoffset" appeared in several issue but none were about yoffset.
What would you expect the API to look like?
(await image.metadata()).yoffset
What alternatives have you considered?
-
Please provide sample image(s) that help explain this feature
-
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how the text input creates an image and how image metadata() is assembled, then compare the available libvips/pyvips xoffset and yoffset values. Done means metadata for text-created images exposes the requested offsets in the documented API, with coverage for the example case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100