-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Line/Shape colors and weights #60
Comments
Hello @blasky,
var text = Image.Text("<i>red</i> text color", dpi: 300);
text = text.Ifthenelse(new[] { 255, 0, 0 }, new[] { 0, 0, 0 }, blend: true);
var text2 = Image.Text("<i>red</i> background", dpi: 300);
text2 = text2.Ifthenelse(new[] { 0, 0, 0 }, new[] { 255, 0, 0 }, blend: true);
Image.Arrayjoin(new[] { text, text2 },
across: 1, shim: 10, background: new double[] { 255, 255, 255 }).WriteToFile("text.png"); The var svg = @"
<svg height='300' width='300'>
<line x1='0' y1='0' x2='300' y2='300' stroke='black' stroke-width='3' />
<circle cx='150' cy='150' r='140' stroke='black' stroke-width='3' fill='red' />
<text x='50%' y='50%' dy='.5em' font-family='Arial' font-weight='bold' font-size='2em' text-anchor='middle' fill='white'>I love SVG!</text>
</svg>";
var image = Image.SvgloadBuffer(Encoding.UTF8.GetBytes(svg), access: Enums.Access.Sequential);
image.WriteToFile("shapes-and-text.png"); The libvips SVG loader is very fast and can make images of any size. It renders progressively, so it doesn't need much memory either. Use the boolean operators to mask other images with the result, or use |
Makes perfect sense. Will do. Thank you. |
Hope this helped, please feel free to re-open if questions remain. |
Morning. Doing some drawing today on my NetVips images. Text and shapes.
Am I correct in my reading of the API that Image.Text() does not take an ink color? Do I need to write the text to my image and then somehow modify the color of what was just written?
And the shape methods, DrawLine(), DrawCircle(), etc., do take an ink color but they do not take a dpi value or line "thickness"? If I want a thicker line do I need to write multiple lines/shapes next to one another?
Thanks.
The text was updated successfully, but these errors were encountered: