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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:39:45+00:00 2026-05-18T09:39:45+00:00

I need a way I can read the lines and extract the pixel info

  • 0

I need a way I can read the lines and extract the pixel info into some structure so I can use the putpixel function to create an image based on the ppm p3 file.

I’m working with Python Imaging Library (PIL) and I want to open a PPM image and display it as an image on the screen.

How can I do that using only PIL?

This is my ppm image. It’s just a 7×1 image that I created.

P3
# size 7x1
7 1
255
0
0
0
201
24
24
24
201
45
24
54
201
201
24
182
24
201
178
104
59
14
  • 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-18T09:39:46+00:00Added an answer on May 18, 2026 at 9:39 am

    edit: After you modified your question and you allow just reading the lines, check the link below. It explains how to write a wrapper that loads the file. I am about to test this myself and it should work…


    You currently (11/2010) cannot open plain PPM images with PIL. Plain here means ascii. Binary versions work however. The main reason for this is that ascii files do not have constant number of bits per pixel. And this is what the image loader in PIL assumes. I have a related question at:

    How to write PIL image filter for plain pgm format?

    I am planning to write a PIL-filter for plain PPM’s but I am short on time. If you are interested to help, please let me know.

    br,
    Juha

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

Sidebar

Related Questions

I need to read the number of lines in a file before doing some
So I can search the whole database but i need a way to change
Been looking around and can't find a definite way to do this... I need
it need a way to call function whose name is stored in a string
I need a way to write over lines in a specific file. As it
I have a list of lines read from a file. I need to sort
I need to read lines in URL html page from specific line. For now,
As part of a project I need to write a parser that can read
I've the need of read a txt file that is structured in this way
I need to extract a line above my search string (say, 19 lines above).

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.