-
Notifications
You must be signed in to change notification settings - Fork 363
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
Watermark with "fogleman/gg" #183
Comments
you need to translate to the centre of the rotation (below works, i think, but has changes other than just bug fix.)
|
also use alpha color... |
I'll check it later, after I get home! Thank you! |
Hi @splace, I tested it and work! I looks like a missed the detail in the documentation about the function I started some test and now I'll look for a function group to save the canvas status (colors, etc.) and restore it after. And ofcourse, add the code to read a existing image and apply the watermark at it center without compromised the original image & text. |
Watermark with "fogleman/gg"
I stumbled into "fogleman/gg" yesterday and immediately seen it as a nice way to add watermark into my images. But I couldn't make ir work.
I started using "fogleman/gg/blob/master/examples/rotated-text.go" as boilerplate, but it seeans the dc.Rotate() do it with all the canvas and I couldn't center the text!
If course the idea is draw a diagonal text over the hypotenuse of the canvas. Exactly into the center.
When I draw the texto with 0 degrees rotarion it is on center. But if I only rotate 45 degrees, it's a mess.
Does anybody can help with that?
The intended steps are:
Get the image bounds and compute hypotenuse, and fit the most large text possible without get clipped out of canvas;
Create a canvas with transparent backgroud and draw the rotate (45º) text;
Save the new picture with a another name;
The step 2 is the tricky one at the moment!
@fogleman ?
Canvas rotated at 45 degress:
Canvas at 0 degress:
Draft souce code:
The text was updated successfully, but these errors were encountered: