Skip to content
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

colorwheel generator #519

Closed
johnnychen94 opened this issue Jan 2, 2022 · 1 comment
Closed

colorwheel generator #519

johnnychen94 opened this issue Jan 2, 2022 · 1 comment

Comments

@johnnychen94
Copy link
Member

using ImageShow

using ImageCore
using OffsetArrays

function colorwheel(sz::Dims{2}, v=1)
    # H, S
    canvas = OffsetArrays.centered(fill(ARGB(0, 0, 0, 0), sz))

    for I in CartesianIndices(canvas)
        x, y = I.I ./ (size(canvas)  2)
        r = sqrt(x*x+y*y)
        if r < 1
            h = atand(y, x)
            canvas[I] = RGB(HSV(h, r, v))
        end
    end
    return canvas
end

This generates the widely used color wheel

colorwheel((1024, 1024))

preview.png

I'm wondering if this should be put here or TestImages.

@johnnychen94
Copy link
Member Author

duplicated to #520

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant