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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:27:12+00:00 2026-05-26T01:27:12+00:00

I have read an image in python using Image module and converted it into

  • 0

I have read an image in python using Image module and converted it into a numpy array as follows…

       im=Image.open(infile)

       imdata = scipy.misc.fromimage(im)

       im.getPixel(x,y)

First question is does x belong to the row number and y to the column number. Is it in the same visual order as we see it on the screen or is it in the order as it has been saved to disk or something else?

How does it work while accessing the pixels values while using it as a numpy array. Does it give the same pixel as im.getPixel() or is it different pixel location?

Third question is that while saving this image to disk e.g as PNG… What should be the order of accessing and writing to the files?

Thanks a lot.

Thanks

  • 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-05-26T01:27:13+00:00Added an answer on May 26, 2026 at 1:27 am

    fromimage

    the docs state that the returned numpy array is of dimension [width, height, nr_channels], where nr_channels are the different colour bands/channels are stored in the third dimension, such that a grey-image is MxN, an RGB-image MxNx3 and an RGBA-image MxNx4

    so to get ‘pixel’ x, y (indeed row-x, height-y) from the array you would do

    pix = a[x,y,:] 
    

    and e.g.

    r,g,b = pix[:3]
    

    im.getPixel
    gets the pixel from the same location (x,y) but as a tuple,e.g. (r,g,b) if the image has rgb bands.
    Note that this method is rather slow; if you need to process larger parts of an image from Python, you can either use pixel access objects (retried via im.load()), or the im.getdata() method.

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

Sidebar

Related Questions

I have read an image in python using Image module and converted it into
I have a FAT12 image file and I have to open it and read
How do I read an image in C so that I can have direct
I am having problems with django forms and image uploads. I have googled, read
I have read that using database keys in a URL is a bad thing
I have a python script that makes a series of url calls using urllib2.
I have a small python cgi script that accepts an image upload from the
I have images read out of a database by Python in the form for
As I have read so far, it seems that the header image of a
I am trying to teach myself digital image process. I have read my pgm

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.