-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add some text #17
Comments
|
I totally missed ImageView.annotations... |
Missed this issue. I also want this feature implemented. Will do that when I'm available. |
@johnnychen94 I made a very basic string->image renderer, that's 100% julia with no lib dependencies. It's not set up to handle line feeds or different alignment, but it's very simple, which might make it well suited to the simplicity of ImageDraw (which I really like). |
It looks good, one potential issue is that julia> @time using BasicTextRender
4.702237 seconds (4.56 M allocations: 257.833 MiB, 4.13% gc time)
julia> @time using ImageFiltering
3.592120 seconds (3.39 M allocations: 200.497 MiB, 5.41% gc time) |
Ah yes. If there's a lighter-weight way to blur an image before resizing, I'd happily swap it out |
Or maybe simply don't. There might be a font size that is not too large to slow the loading, nor too small for a nice resize within reasonable margins. This is very simple, so you'll run into feature-requests pretty quick. This can just be one of them. |
Maybe it could use something like this and define the font at it's smallest size, and scale up instead of scaling down.. no blurring needed Edit: More thought on this.. it would require font sizes to be equal to integer multiples of the height of the base font (9 pixels) |
We could conceivably split ImageFiltering into smaller pieces, but since BasicTextRender uses two of the major arms ( |
Suddenly Basic doesn't seem so basic... How about just using FreeTypeAbstraction.jl? These times seem manageable? using ImageCore, BenchmarkTools
@time using FreeTypeAbstraction
#1.035022 seconds (1.61 M allocations: 96.270 MiB)
@time face = newface(joinpath(@__DIR__,"monogram.ttf"))
#0.019520 seconds (50.55 k allocations: 2.532 MiB)
img = rand(RGBA{Float64},110,1300)
@btime renderstring!(img, "String", face, (170,170), 10, 10, halign=:hleft,
valign=:vtop, fcolor=RGBA(0.0, 0.0, 0.0, 1.0), bcolor=nothing)
#108.284 μs (429 allocations: 57.63 KiB) |
Hey @ianshmean @yakir12 ,has there been any progress on this task from your side?? |
no news from me... |
I would like to work on this if that's okay |
I think @IanButterworth and @timholy are the main contributors to this specific problem (and many many more). I think it's safe to say that both welcome high quality PRs! But I'm sure they'll have a lot more to say about where this specific issue is at. |
I think Ian Butterworth's solution in BasicTextRender.jl uses proper bitmap fonts method only,Luxor.jl uses Cairo toy text Text API |
Other than colored shapes, it would be great if we could also add some text to the images.
I use this to color tracked paths in a composite image from time-lapse images, but I need to some how label individual tracks with an ID (like a bunch of numbers and/or letters).
Hmmm, maybe it would be easier to combine the image with vector graphics somehow.
The text was updated successfully, but these errors were encountered: