Skip to content

Mutate to Polar coordinates #2724

Discussion options

You must be logged in to vote

The GIMP plugin has a bunch of options which I haven't worked out but here's a basic implementation.

using (Image<Rgba32> image = Image.Load<Rgba32>(@"C:\Users\james\Downloads\polar-in.jpg")) // Load your image
{
    int width = image.Width;
    int height = image.Height;
    var center = new PointF(width / 2f, height / 2f);
    float maxRadius = Math.Min(center.X, center.Y);

    using (Image<Rgba32> polarImage = new(width, height))
    {
        polarImage.Mutate(ctx =>
        {
            ctx.ProcessPixelRowsAsVector4((pixelRow, offset) =>
                {
                    for (int x = 0; x < pixelRow.Length; x++)
                    {
                        // Map to polar coor…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@LuisAlfredo92
Comment options

Comment options

You must be logged in to vote
2 replies
@LuisAlfredo92
Comment options

@JimBobSquarePants
Comment options

Answer selected by LuisAlfredo92
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants