You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On our project, we decided to use your product instead of ImageMagick.
Net-vips is not documented well, and I'm having difficulties with implementation simple things.
I need to overlay colored text (with an alpha layer) on the picture.
I tried to do this as shown in one of the php-vips examples.
libvips and this binding is rather low-level and requires some experience in image processing. I admit that the documentation could be a bit more extensive (see #99).
NewFromImage has a params overload where you can pass a single-dimensional array, for example:
@@ -4,7 +4,7 @@
using var text = Image.Text("Hello", "Arial 36px", width: image.Width -100);
using var overlay = text
- .NewFromImage(Image.NewFromArray(new[,] { { 255, 0, 0 } }))+ .NewFromImage(255, 0, 0)
.Copy(interpretation: Enums.Interpretation.Srgb)
.Bandjoin(text);
If you want a bit of opacity in the text, you could use:
@@ -3,10 +3,13 @@
using var image = Image.NewFromFile("sample.jpg", access: Enums.Access.Sequential);
using var text = Image.Text("Hello", "Arial 36px", width: image.Width -100);
+ // we'll use that as the alpha ... scale down to make it transparent+ using var alpha = (text * 0.3).Cast(Enums.BandFormat.Uchar);+
using var overlay = text
.NewFromImage(255, 0, 0)
.Copy(interpretation: Enums.Interpretation.Srgb)
- .Bandjoin(text);+ .Bandjoin(alpha);
image.Composite(overlay, Enums.BlendMode.Over, 400, 400).
WriteToFile("_result.jpg");
Also see libvips/pyvips#204 for other effects you could apply to text (such as shadows or neon effects).
Hi Net-Vips!
On our project, we decided to use your product instead of ImageMagick.
Net-vips is not documented well, and I'm having difficulties with implementation simple things.
I need to overlay colored text (with an alpha layer) on the picture.
I tried to do this as shown in one of the php-vips examples.
libvips/php-vips#94
But I get an exception on
image.Composite
line .Please, correct me, what I am doing something wrong.
The text was updated successfully, but these errors were encountered: