Hi there! I''m studying RMagick graphics manipulation gem, and I need to put small text about size 8 to 11 px on pictures. I found that text() method prints quite blurred text. And I could not get clear text chosing different values for methods font, font_family, font_style, font_weigth. I attached a picture. In the left of it you can see what RMagick generates for me and in the right you can see the example of clear text I need RMagick to generate for me. What can I do to get clear text. Any ideas? Attachments: http://www.ruby-forum.com/attachment/2862/Image_text.png -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Zhan Tuaev wrote:> Hi there! > I''m studying RMagick graphics manipulation gem, and I need to put small > text about size 8 to 11 px on pictures. I found that text() method > prints quite blurred text. And I could not get clear text chosing > different values for methods font, font_family, font_style, font_weigth. > > I attached a picture. In the left of it you can see what RMagick > generates for me and in the right you can see the example of clear text > I need RMagick to generate for me. > > What can I do to get clear text. Any ideas?Here is my code: gc.stroke_width(1) gc.pointsize(10) gc.stroke(''black'') gc.font_style(Magick::NormalStyle) gc.font_weight(Magick::LighterWeight) gc.text(x,y, "12:00") -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
In my text drawing, I set stroke to transparent and fill to the desired text color. Also, you could try turning off antialiasing. I ended up using anti-aliasing, but rendering the text at double size and scaling down for acceptable results. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jim wrote:> In my text drawing, I set stroke to transparent and fill to the > desired text color. Also, you could try turning off antialiasing. I > ended up using anti-aliasing, but rendering the text at double size > and scaling down for acceptable results.Hi, Jim! how can I turn off anti-aliasing? I tried to call / not to call methods fill() and stroke(). result is different in all cases: gc.fill(''black'') #results in: Attachments: http://www.ruby-forum.com/attachment/2863/fill_only.png -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> I tried to call / not to call methods fill() and stroke(). > result is different in all cases: > > gc.fill(''black'') #results in:#gc.fill(''black'') # call is commented out gc.stroke(''black'') # results in: Attachments: http://www.ruby-forum.com/attachment/2864/stroke_only.png -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Zhoran Tvalve wrote:>> I tried to call / not to call methods fill() and stroke(). >> result is different in all cases: >> >> gc.fill(''black'') #results in: > > #gc.fill(''black'') # call is commented out > gc.stroke(''black'') # results in:gc.fill(''black'') gc.stroke(''black'') # calling both results in: Attachments: http://www.ruby-forum.com/attachment/2865/stroke___fill.png -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Zhoran Tvalve wrote:> Zhoran Tvalve wrote: >>> I tried to call / not to call methods fill() and stroke(). >>> result is different in all cases: >>> >>> gc.fill(''black'') #results in: >> >> #gc.fill(''black'') # call is commented out >> gc.stroke(''black'') # results in: > > gc.fill(''black'') > gc.stroke(''black'') # calling both results in:Сomparing these three pictures you can see, that calling both methods stroke() and fill() makes best picture, but I still need better. Something like at attached picture (I used pixel editor :) to prepare it) And It seems to me that scaling down could not make accurate symbols. Attachments: http://www.ruby-forum.com/attachment/2866/needed.png -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I would have something like: gc.stroke(''transparent'').stroke_antialias(false) gc.fill(''black'') The stroke_width setting won''t have any effect on the text. I also never saw any variation from using the font_style or font_weight settings. I''m not sure if turning off antialiasing has any effect on text, since I now have that commented out in my code. I still turn off antialiasing when drawing lines because I only draw rectangles. On an angled line you might need it. The font you choose may also have something to do with it. Run convert -list font at the command line to see the available fonts and families on your system. Jim Crate Que Viva Development --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jim wrote:> I would have something like: > > gc.stroke(''transparent'').stroke_antialias(false) > gc.fill(''black'') > > The stroke_width setting won''t have any effect on the text. I also > never saw any variation from using the font_style or font_weight > settings. I''m not sure if turning off antialiasing has any effect on > text, since I now have that commented out in my code. I still turn > off antialiasing when drawing lines because I only draw rectangles. > On an angled line you might need it. > > The font you choose may also have something to do with it. Run > > convert -list font > > at the command line to see the available fonts and families on your > system. > > > Jim Crate > Que Viva DevelopmentHi, Jim! It really works!! I just turned off antialiasing and got it!!! Please take a look at the pictures. That is what I needed. Thank you for your help! Attachments: http://www.ruby-forum.com/attachment/2873/1.png -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Good luck, Jim ;) Attachments: http://www.ruby-forum.com/attachment/2874/2.png -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Zhoran Tvalve wrote:> Hi, Jim! > It really works!! I just turned off antialiasing and got it!!! > Please take a look at the pictures. That is what I needed. > Thank you for your help!One note more. I''ve checked again and found that result defends on both callings @gc.stroke(''transparent'').stroke_antialias(false) @gc.text_antialias = false the best result (which I showed upper) produced by calling both methods. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
hmm...I never noticed the text_antialias method before. I''ll have to remember that the next time I run into issues. Glad I could help! Jim --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---