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 9085949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:22:11+00:00 2026-06-16T21:22:11+00:00

I need to rotate a lot of images in a folder using Python. I

  • 0

I need to rotate a lot of images in a folder using Python. I found out, it could be done using ndimage.rotate. But I get a problem, as the image is not being rotated: I wait and wait, and it takes so much time…

This is the discussed part of my code:

for image in filelist:
    print 'Checking ', os.path.basename(image)
    im = misc.imread(image)
    geom = im.shape
    print geom
    if geom[1] > geom[0]:
        # Some code to determine the way image should be rotated, which 
        # calculates angle
        print 'Rotating ', os.path.basename(image)
        rotated = ndimage.rotate(im, angle, reshape = False)
        print 'Rotated ', os.path.basename(image)
        misc.imsave(image, rotated)
    else:
        print os.path.basename(image), ' is OK'

When I run it it works really slow, about 20 sec per image. How to do it faster? I would appreciate any help with it.

And just in case, I am not a professional programmer.

  • 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-16T21:22:12+00:00Added an answer on June 16, 2026 at 9:22 pm

    The solution is to use PIL instead of ndimage as deinonychusaur suggested. You might want to look here:
    pythonware.com/library/pil/handbook/introduction.htm

    It has everything needed to write a program with PIL.

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

Sidebar

Related Questions

I need to rotate png images (some circle disks). It is done with some
I need to rotate in image multiple times in 90 degrees I am using
I have a directory full of log files that I need to rotate using
I've been searching a lot on this problem, but I couldn't really find an
I have an sprite the I need to rotate it with touch but it
I need to rotate an image 90 degrees, and I figured using GDI+ would
I need to rotate an image when the user do a two finger twist
I have a point in a rectangle that I need to rotate an arbitrary
I need to write a program that uses matrix multiplication to rotate an image
In my app I need to get mirrored and rotated copies of video files

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.