How to convert text to image with Images.jl?

question
images
strings

#1

How to convert text stored in a Julia string to an image of given size? For example, let’s say we are given the word “Julia”, how can we generate the logo with WIDTHxHEIGHT pixels?


#2

Use a plotting package or Luxor.jl?


#3

If you just want text over an image, ImageView.jl has an annotation API.


#4

@mkborregaard, thanks for sharing Luxor.jl, it looks awesome.


#5

@dfdx, the annotation API is very helpful, will play with it, thanks.


#6

Yes, it’s great - and it has a julialogo function to draw the julia logo (which I know isn’t what you were after but still cool :slight_smile: )


#7

Wow Luxor.jl is so stupid amazing! But boy dojulianshateunderscores…


#8

:slight_smile:

I had to stop using underscores when I used Mathematica (they’re not allowed in variable names). I had to stop using hyphens when I stopped using Lisp. I’m getting used to the “join words when readable” style.

I missed these ones, though:

douglas_peucker()
intersection_line_circle()
paint_with_alpha()
paper_sizes()     
saved_colors

#gettingusedtonotusingunderscores


#9

lol … oh man it will hurt when we have to do intersectionlinecircle() :slight_smile: Thanks so much for Luxor.jl. Been losing my mind using it lately. Love it so much. I have been thinking about trying to have it write to a Gtk.jl canvas, I haven’t looked at the code, but being based on Cairo do you think this would be feasible for a mortal to implement?


#10

It might be possible. It is very un-interactive, I agree. I tread very warily in Cairo waters, and avoid them whenever possible…

Personally I tend to focus on a simpler UI and larger and more static graphics. I think Julia should definitely offer interactive graphics, and projects such as gtkreactive and glvisualize are probably where the future is.


#11

It’s possible, i have done this locally. I added functions to access the surface in the Luxor currentdrawing and attaching to the surface from the context in a Gtk canvas shouldn’t be problem (read as: i had a plan to do it, but got distracted by other problems, mainly v0.6 in Cairo).


#12

sweetness! That is what I figured, from a memory long ago of working with Cairo. I will see if I can put something together!


#13

the unregistered https://github.com/JuliaGraphics/FreeTypeAbstraction.jl can draw text into a matrix.


#14

Thank you @bjarthur, one more package to add to the collection.