473,466 Members | 1,363 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Drawing a 640x480 Ras Image

I'm getting a 640x480 greyscale image from a video device. I'd like to place
it on a canvas and then draw on the image. Does PIL or some image facility
allow me to do that?

--
Wayne Watson (Nevada City, CA)

Web Page: <speckledwithStars.net>
Sep 21 '07 #1
4 1925
Corrected misspelling in Subject. The image here is nothing more than a
640x480 byte array. Each byte is a gra[e]yscale value.

W. Watson wrote:
I'm getting a 640x480 greyscale image from a video device. I'd like to
place it on a canvas and then draw on the image. Does PIL or some image
facility allow me to do that?
--
Wayne Watson (Nevada City, CA)

Web Page: <speckledwithStars.net>
Sep 21 '07 #2
On Thu, 20 Sep 2007 20:49:59 -0700, W. Watson wrote:
W. Watson wrote:
>I'm getting a 640x480 greyscale image from a video device. I'd like to
place it on a canvas and then draw on the image. Does PIL or some image
facility allow me to do that?

Corrected misspelling in Subject. The image here is nothing more than a
640x480 byte array. Each byte is a gra[e]yscale value.
PIL can do this:

from PIL import Image

def main():
width = 640
height = 480
image = Image.new('L', (width, height))
data = [x * y % 256 for x in xrange(width) for y in xrange(height)]
image.putdata(data)
image.save('test.png')

`data` can be any iterable with byte values.

Ciao,
Marc 'BlackJack' Rintsch
Sep 21 '07 #3
Very good. I'll give it a try.

Marc 'BlackJack' Rintsch wrote:
On Thu, 20 Sep 2007 20:49:59 -0700, W. Watson wrote:
>W. Watson wrote:
>>I'm getting a 640x480 greyscale image from a video device. I'd like to
place it on a canvas and then draw on the image. Does PIL or some image
facility allow me to do that?
Corrected misspelling in Subject. The image here is nothing more than a
640x480 byte array. Each byte is a gra[e]yscale value.

PIL can do this:

from PIL import Image

def main():
width = 640
height = 480
image = Image.new('L', (width, height))
data = [x * y % 256 for x in xrange(width) for y in xrange(height)]
image.putdata(data)
image.save('test.png')

`data` can be any iterable with byte values.

Ciao,
Marc 'BlackJack' Rintsch
--
Wayne Watson (Nevada City, CA)

Web Page: <speckledwithStars.net>
Sep 21 '07 #4
Oops. What I think I'm looking for is a way to open a data file of records
that are 640x480 that are gray scaled. I probably need something like an
open and a read. Once I've got that, then I need to place the raw image into
a draw area on the canvas, so that I can draw on the image.

W. Watson wrote:
Very good. I'll give it a try.

Marc 'BlackJack' Rintsch wrote:
>On Thu, 20 Sep 2007 20:49:59 -0700, W. Watson wrote:
>>W. Watson wrote:
I'm getting a 640x480 greyscale image from a video device. I'd like
to place it on a canvas and then draw on the image. Does PIL or some
image facility allow me to do that?
Corrected misspelling in Subject. The image here is nothing more than
a 640x480 byte array. Each byte is a gra[e]yscale value.

PIL can do this:

from PIL import Image

def main():
width = 640
height = 480
image = Image.new('L', (width, height))
data = [x * y % 256 for x in xrange(width) for y in xrange(height)]
image.putdata(data)
image.save('test.png')

`data` can be any iterable with byte values.

Ciao,
Marc 'BlackJack' Rintsch
--
Wayne Watson (Nevada City, CA)

Web Page: <speckledwithStars.net>
Sep 21 '07 #5

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

Similar topics

1
by: news.microsoft.com | last post by:
Hello group, My goal is to attach an image over another image. Top image should be transparent so the back image is visible through the top one. Bellow is a test code in VB.NET. You need to...
7
by: Toby Mathews | last post by:
Hi, In an ASP.Net application I want to convert open create a FileStream object from a System.Drawing.Image - is this possible? I create an instance of an Image object using the FromFile method,...
2
by: James Coburn's Grey Helmet Hair | last post by:
When I try to compile my GTK# app, the compiler says: jbailo@linux:~/mono> mcs buttons.cs -r gtk-sharp.dll -r glib-sharp.dll -r -o buttons.exe error CS2001: Source file 'buttons.exe' could not...
0
by: John via .NET 247 | last post by:
Hi, I'm using the System.Drawing.Bitmap namespace to load an image,and the RotateNoneFlipY method to flip that image before saving.However I have noticed that the saved image appears cropped...
7
by: Chris Podmore | last post by:
This is probably a stupid question but here goes anyway. What's the best way to design web pages that work in 640x480 or 800x600 and above? The pages I have created look fine in 800x600 or above...
5
by: Jerry J | last post by:
I want to use the System.Drawing.Image class. According to the help file, this is an abstract base class. Because it is supposedly abstract, I created another class that inherits from it. However,...
3
by: Dave Keen | last post by:
Hi all. Hope you can help me. This should be easy but I can't make this work. In brief I am building a page of thumbnails using images held in a SQLServer 2000 database. I do this by creating...
2
by: luckyguy4ru | last post by:
Hello every body, I just joined today this forum hopping that i will get really good help here, My final project is to refashioned an artist work which is mostly pencil work, i have fake color...
2
by: ThatsIT.net.au | last post by:
I have this code that writes a pie chart in a asp.net page, but I want to use it in a server control. When I try I get a error on the last line "Response.OutputStream" Obviously there is no...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.