Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8841329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:41:18+00:00 2026-06-14T10:41:18+00:00

I have bunch of images (say 10) I have generated both as array or

  • 0

I have bunch of images (say 10) I have generated both as array or PIL object.

I need to integrate them into a circular fashion to display them and it should adjust itself to the resolution of the screen, is there anything in python that can do this?

I have tried using paste, but figuring out the resolution canvas and positions to paste is painful, wondering if there is an easier solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:41:20+00:00Added an answer on June 14, 2026 at 10:41 am

    We can say that points are arranged evenly in a circle when there is a constant angle theta between neighboring points. theta can be calculated as 2*pi radians divided by the number of points. The first point is at angle 0 with respect to the x axis, the second point at angle theta*1, the third point at angle theta*2, etc.

    Using simple trigonometry, you can find the X and Y coordinates of any point that lies on the edge of a circle. For a point at angle ohm lying on a circle with radius r:

    xFromCenter = r*cos(ohm)
    yFromCenter = r*sin(ohm)
    

    Using this math, it is possible to arrange your images evenly on a circle:

    import math
    from PIL import Image
    
    def arrangeImagesInCircle(masterImage, imagesToArrange):
        imgWidth, imgHeight = masterImage.size
    
        #we want the circle to be as large as possible.
        #but the circle shouldn't extend all the way to the edge of the image.
        #If we do that, then when we paste images onto the circle, those images will partially fall over the edge.
        #so we reduce the diameter of the circle by the width/height of the widest/tallest image.
        diameter = min(
            imgWidth  - max(img.size[0] for img in imagesToArrange),
            imgHeight - max(img.size[1] for img in imagesToArrange)
        )
        radius = diameter / 2
    
        circleCenterX = imgWidth  / 2
        circleCenterY = imgHeight / 2
        theta = 2*math.pi / len(imagesToArrange)
        for i, curImg in enumerate(imagesToArrange):
            angle = i * theta
            dx = int(radius * math.cos(angle))
            dy = int(radius * math.sin(angle))
    
            #dx and dy give the coordinates of where the center of our images would go.
            #so we must subtract half the height/width of the image to find where their top-left corners should be.
            pos = (
                circleCenterX + dx - curImg.size[0]/2,
                circleCenterY + dy - curImg.size[1]/2
            )
            masterImage.paste(curImg, pos)
    
    img = Image.new("RGB", (500,500), (255,255,255))
    
    #red.png, blue.png, green.png are simple 50x50 pngs of solid color
    imageFilenames = ["red.png", "blue.png", "green.png"] * 5
    images = [Image.open(filename) for filename in imageFilenames]
    
    arrangeImagesInCircle(img, images)
    
    img.save("output.png")
    

    Result:

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have code that loads a bunch of images into hidden img elements and
I have a bunch of images with different sizes. Each of them should be
I have a bunch of images at random heights and widths that need to
I have a bunch of images which all fit into a 400px × 400px
Right now I have a bunch of images stored in an array. I want
I have a bunch of images in a folder that are effectively just pieces
I have a bunch of images that are in a hidden div. The div
I have a bunch of images lined up that I want to on hover
I'm developing an iPhone application where I have a bunch of images bundled with
I have a page where I am loading bunch of images initially when the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.