473,385 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

PIL Question: Inverse of <image>.load()?

I'm doing some image processing that requires accessing the individual
pixels of the image. I'm using PIL 1.1.6 and creating a 2D array of
pixel RGB tuples using the Image class instance load() method.
Unfortunately, I can't seem to find a reciprocal function that
converts the 2D array of RGB tuples back to an image. I've gone
through all of the online documentation and can't seem to find what
should be an obvious solution.

Any thoughts?
Aug 16 '08 #1
2 2782
Casey wrote:
I'm doing some image processing that requires accessing the individual
pixels of the image. I'm using PIL 1.1.6 and creating a 2D array of
pixel RGB tuples using the Image class instance load() method.
load returns an access object that's attached to the image; to modify
the image, just assign to the object:

pix = im.load()

v = pix[x, y]
pix[x, y] = v

to do bulk loads, you can use the getdata/putdata methods instead.

</F>

Aug 16 '08 #2
On Aug 16, 3:53 am, Fredrik Lundh <fred...@pythonware.comwrote:
Casey wrote:
I'm doing some image processing that requires accessing the individual
pixels of the image. I'm using PIL 1.1.6 and creating a 2D array of
pixel RGB tuples using the Image class instance load() method.

load returns an access object that's attached to the image; to modify
the image, just assign to the object:

pix = im.load()

v = pix[x, y]
pix[x, y] = v

to do bulk loads, you can use the getdata/putdata methods instead.

</F>
Ah - I didn't realize from the docs that the results of load() is an
in situ edit to the original buffer. Thanks!
Aug 16 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Csaba2000 | last post by:
I want to be able to programatically click on the center of an <INPUT type=image ...> element (I only care about IE 5.5+). This should work regardless of whether IE has focus. Normally you would...
3
by: Csaba Gabor | last post by:
When I click on the image form element <INPUT type=image name=point src="map.png"> point.x and point.y values get submitted to the server specifying where on the image I have clicked. Is there...
3
by: Frank Wein | last post by:
Hi, today i found out some browsers (at least Mozilla and IE) support the <image> tag, its usage seems to be the same as for the <img> tag (IMDB.com uses it for example). I did not find anything...
1
by: Chris Fink | last post by:
Hello, Does anyone know of a way to handle broken href image tags either by using the html img tag or the asp:image server control? For example, if my src attribute is broken, I would like to...
0
by: DavidS | last post by:
I have HTML web page with <asp:Image id=img_L runat=server ImageAlign=Top Visible=True Width=y Height=x></asp:Image>. For some images, less than 128K I can view image. Other image files > 128K,...
0
by: topdawg147 | last post by:
Whenever I rotate/flip a tiff image, the RawFormat changes from Tiff to MemoryBitmap. ' image format is tiff. imgSomePic.RotateFlip(RotateFlipType.Rotate180FlipNone) ' now image format is...
3
by: jackiepatti | last post by:
QUESTION: I have a web page containing a form that contains an image instead of a submit button, e.g. <form name='myform' action='get' method='otherpage.asp'> <input type='image'...
1
by: MRW | last post by:
Hello! I'm taking a file name from a database and using the <asp:imagetag in GridView to show the image. However, some of the file names have spaces in it and no matter what I do, for example:...
3
by: MRW | last post by:
Hello! I'm taking a file name from a database and using the <asp:imagetag in GridView to show the image. However, some of the file names have spaces in it and no matter what I do, for example:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.