Vitalii on wrote...
| Vitalii <[EMAIL PROTECTED]> sent the following
| comment to "anthony", about "MagickNet".
| You are reading it:-
| ------------------------------------------------------------
| Hello, Anthony!
| Just a week since my meeting with IM.
| I use MagickNet dll in my .NET application.
| And I hit with next problem:
| I need to convert psd image to gif and insert some text.
| There are possible some modification of text (i.e. rotation, wave, etc.)
| I create new Image draw text, then apply modification to it, than do
background transparent and then composite with psd template and convert to gif
format.
| If rotation degree 0, 90 or 180 the result is OK, but if degree is 30, 45 and
so on, the result is not good, there are some black points around the text.
| I be very much obliged to you if you can help me to solve this problem.
| There is some code bellow (C# VS 2005):
|
| Magick.Init();
| Image img = new Image(new
StreamReader("template.psd").BaseStream);
|
| //Image this text
| Image imgText1 = new Image(new Geometry(200, 30), new
Color(System.Drawing.Color.Black));
| imgText1.FillColor = new Color(System.Drawing.Color.Red);
| imgText1.Antialias = false;
| imgText1.Annotate(text, GravityType.NorthWestGravity);
|
| int degree = 43;
| imgText1.Rotate(degree);
|
| imgText1.Transparent(new Color(System.Drawing.Color.Black));
|
| img.Composite(imgText1, 0, 0, CompositeOperator.AtopCompositeOp);
|
| img.Write("result.gif");
| Magick.Term();
|
I recommend you submit your question to the IM forum.
Anti-alias only effects drawing, it does not effect rotation.
As such you have some redish black colors around the edges of your text
which the Transparent() does not match and convert to transparency!
Solutions, in order of changes to your algorithm...
1. Rotate with interpolation set to 'Integer' or 'NearestNeighbor'
so it will not interpolate the colors
2. Draw the text with 43 degree rotation directly using Annotate()
rather than post rotationing it with Rotate()
3. Recolor all non-transparent pixels to red AFTER rotating and
making black transparnet
4. Simplify using a label....
That is.
* Create a label image of your text fill=red background=none
* Rotate it with a background of none (already set)
* Threshold the alpha channel at 50% to make all colors either
red or transparent.
* Now overlay it!!!!
5. The best way... which is the simplist!!!
Annotate with a rotation and anti-aliasing turned off
directly onto the image!!! Position it with gravity.
Anthony Thyssen ( System Programmer ) <[EMAIL PROTECTED]>
-----------------------------------------------------------------------------
Nice Computers don't go down.
-----------------------------------------------------------------------------
Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users