473,566 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ 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: <speckledwithSt ars.net>
Sep 21 '07 #1
4 1933
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: <speckledwithSt ars.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(d ata)
image.save('tes t.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(d ata)
image.save('tes t.png')

`data` can be any iterable with byte values.

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

Web Page: <speckledwithSt ars.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(d ata)
image.save('tes t.png')

`data` can be any iterable with byte values.

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

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

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

Similar topics

1
2393
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 create a form, a button (Button1) and an Picture Box (picBox). "watermark.jpg" is any jpg image, "beispiel.tif" is a multipage TIFF image with the...
7
14191
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, then use the GetThumbnailImage method to create a second Image. This second one is the one I want to get a FileStream from, so that I can then use...
2
391
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 be opened Compilation failed: 1 error(s), 0 warnings jbailo@linux:~/mono> mcs buttons.cs -r gtk-sharp.dll -r glib-sharp.dll -o buttons.exe...
0
1838
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 andhas a large blue area on a particular side, which gets largerevery time the image is flipped again. I'm assuming that this may be due to a lack of...
7
1233
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 but my boss has just been to a site that runs their desktops at 640x480 and has come back with a load of comments about how rubbish it all looks. It...
5
3356
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, when I did this I got the following error: 'System.Drawing.Image.Image()' is inaccessible due to its protection level Looking at other online...
3
6422
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 imagebuttons which point to a dummy page that takes the image and displays it via response. All works fine if I use explicit paths to a file...
2
1865
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 pallet and fill color to fill and use different color while modifying and existing image, but when i import an image on stage and start drawing, it...
2
2314
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 response object but how do I write it to screen? Dim objBitmap As New System.Drawing.Bitmap(400, 440) Dim objGraphics As System.Drawing.Graphics...
0
7666
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7888
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7951
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2083
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 we have to send another system
1
1201
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.