JuliaImages / ImageDraw.jl

Drawing Package for JuliaImages
Other
27 stars 17 forks source link

Add logo for document #63

Closed hyrodium closed 3 years ago

hyrodium commented 3 years ago

Hi! i'm now planning to add logo images to ImageDraw.jl.

logo logo-dark

image image

using Images, ImageDraw

# original image
img = load(download("https://raw.githubusercontent.com/JuliaImages/juliaimages.github.io/source/docs/src/assets/logo.png"))

# Define some colors
c_r, c_g, c_b, c_p = RGBA.([Colors.JULIA_LOGO_COLORS...])
gray_dark = RGBA{N0f8}(0.1,0.1,0.1)
gray_light = RGBA{N0f8}(0.9,0.9,0.9)

# change base corlor black to gray
img = img*N0f8(0.5) .+ RGBA{N0f8}(0.5,0.5,0.5,0)
img_dark = copy(img)
img_light = copy(img)

# define points on the image
p_green = Point(87,35)
p_red = Point(75,55)
p_purple = Point(99,55)
p1 = Point(13,96)
p2 = Point(52,50)
p3 = Point(73,73)
p4 = Point(84,62)
p5 = Point(116,97)

for (img,gray,name) in ((img_dark,gray_light,"logo-dark.png"), (img_light,gray_dark,"logo.png"))
    draw!(img, LineTwoPoints(p1,p2), gray)
    draw!(img, LineTwoPoints(p2,p3), gray)
    draw!(img, LineTwoPoints(p3,p4), gray)
    draw!(img, LineTwoPoints(p4,p5), gray)

    draw!(img, Cross(p1,8), gray)
    draw!(img, Cross(p2,8), gray)
    draw!(img, Cross(p3,8), gray)
    draw!(img, Cross(p4,8), gray)
    draw!(img, Cross(p5,8), gray)

    draw!(img, Ellipse(CirclePointRadius(p_green,10)), c_g)
    draw!(img, Ellipse(CirclePointRadius(p_red,10)), c_r)
    draw!(img, Ellipse(CirclePointRadius(p_purple,10)), c_p)

    save(name,img)
end

Do you have any comments?

johnnychen94 commented 3 years ago

👍 looks good to me

hyrodium commented 3 years ago

The PR is merged, so I'll close this issue.