Re: PIL question. having exactly same font on multiple platforms

2011-08-04 Thread Thomas Jollans
On 04/08/11 12:04, Gelonida N wrote: I posted already a question, but perhaps the subject line wasn't clear. Subject line was Text to image with same results on any platform Oh, your original message was perfectly clear, and if I knew the answer, I might have responded. Anyway, into

Re: PIL question. having exactly same font on multiple platforms

2011-08-04 Thread Steven D'Aprano
Gelonida N wrote: I wondered what library would be appropriate and would yield the same result independent of the OS (assuming the versions of the python libraries are the same) Images should be pixel identical independent on the platform on which the image is created. Short answer: you

Re: PIL question. having exactly same font on multiple platforms

2011-08-04 Thread Gelonida N
On 08/04/2011 12:32 PM, Thomas Jollans wrote: On 04/08/11 12:04, Gelonida N wrote: Thanks for your answer. From within a django application I'd like create a small image file (e.g. .png) which just contains some text. I wondered what library would be appropriate and would yield the same

Re: PIL question. having exactly same font on multiple platforms

2011-08-04 Thread Irmen de Jong
On 4-8-2011 20:54, Gelonida N wrote: The reason why I want the images to look identical is very simple. Though the final web server will run on a linux server, I use sometimes windows for development or as test server. For automated tests I would have liked pixel identical images. this

Re: PIL question. having exactly same font on multiple platforms

2011-08-04 Thread Irmen de Jong
On 4-8-2011 21:30, Irmen de Jong wrote: As far as I know, I did not see any difference in output on windows, linux and mac os x as long as the code used the same ttf file and PIL versions. (but I'll double check now and see if I remember this correctly). To follow up on myself, I've just

Re: PIL question. having exactly same font on multiple platforms

2011-08-04 Thread Gelonida N
Thanks again to everybody, Your answers helped me to understand better. My pragmatic solution is now to package my program with an open source .ttf font, which will be used on both platforms. On 08/04/2011 10:24 PM, Irmen de Jong wrote: On 4-8-2011 21:30, Irmen de Jong wrote: As far as I

Re: PIL Question

2011-05-02 Thread nirinA raseliarison
[PyNewbie] Question: I can't seem to find the captured image, where does it go? for me, it just goes to the current working directory: $ python -i Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits or license for more

Re: PIL Question

2011-05-01 Thread Chris Rebert
On Sun, May 1, 2011 at 1:50 PM, PyNewbie ryan.morr...@gmail.com wrote: Hi, I'm new with Python and PIL. I have a very simple question regarding an image capture function I'm attempting. Here is the code: from PIL import ImageGrab ImageGrab.grab().save(screen_capture.jpg, JPEG)

Re: PIL Question

2011-05-01 Thread Terry Reedy
On 5/1/2011 9:00 PM, Chris Rebert wrote: I would think to a file named screen_capture.jpg in the current working directory. What that is for IDLE, I don't know. At least on windows with 3.2, if one just starts up the shell, it is in the Pythonxy directory. If one runs a file from an edit

Re: PIL question

2010-04-06 Thread Peter Otten
Tim Eichholz wrote: I'm trying to cut a BMP with 80 adjacent frames down to 40 using the Image.copy and .paste functions but I'm getting error ValueError: images do not match on the paste line. newimage.paste(cols[f], (f*framew, 0, (f*framew)+192, 192)) The 4-tuple doesn't match the size of

Re: PIL question

2010-04-06 Thread Tim Eichholz
On Apr 6, 3:05 am, Peter Otten __pete...@web.de wrote: Tim Eichholz wrote: I'm trying to cut a BMP with 80 adjacent frames down to 40 using the Image.copy and .paste functions but I'm getting error ValueError: images do not match on the paste line. newimage.paste(cols[f], (f*framew, 0,

Re: PIL question

2010-04-06 Thread Peter Otten
Tim Eichholz wrote: I think maybe I am using the wrong function. I want to paste the entire 192x192 contents of cols[f] into newimage. I would think it works like newimage.paste(cols[f], (x, 0, 192+x, 192)) if that's not it I think I'm missing a function Don't think! Read the documentation

Re: PIL question

2010-04-06 Thread Lie Ryan
On 04/06/10 19:47, Peter Otten wrote: Tim Eichholz wrote: I think maybe I am using the wrong function. I want to paste the entire 192x192 contents of cols[f] into newimage. I would think it works like newimage.paste(cols[f], (x, 0, 192+x, 192)) if that's not it I think I'm missing a

Re: Python Imaging Library (PIL) question

2008-10-21 Thread Sid
The problem is likely to do with the line picMap = [[0] * width ] * height yeah the problem was with that specific line. The snippet from your link worked by replacing the previous declaration by picMap = [[0] * 3 for x in xrange(height)] Thanks, -Sid --

Python Imaging Library (PIL) question

2008-10-20 Thread Sid
Hi, I am tryin to copy an image into my own data structure(a sort of 2d array for further FFT). I've banged my head over the code for a couple of hours now. The simplified version of my problem is below. #-Code import Image pic =

Re: Python Imaging Library (PIL) question

2008-10-20 Thread Darcy Mason
On Oct 20, 2:14 pm, Sid [EMAIL PROTECTED] wrote: Hi,   I am tryin to copy an image into my own data structure(a sort of 2d array   for further FFT). I've banged my head over the code for a couple of hours   now. The simplified version of  my problem is below.

Re: PIL Question: Inverse of image.load()?

2008-08-16 Thread Fredrik Lundh
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

Re: PIL Question: Inverse of image.load()?

2008-08-16 Thread Casey
On Aug 16, 3:53 am, Fredrik Lundh [EMAIL PROTECTED] wrote: 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

Re: screencapture with PIL question

2008-07-15 Thread Gabriel Genellina
En Mon, 14 Jul 2008 12:11:55 -0300, greg [EMAIL PROTECTED] escribi�: I am able to use the PIL module to capture a screen or specific window. My problem is when capturing a window (on windows XP) I can only capture the visible portion of the window. Is there any way to capture the entire

Re: screencapture with PIL question

2008-07-15 Thread Fredrik Lundh
greg wrote: I am able to use the PIL module to capture a screen or specific window. My problem is when capturing a window (on windows XP) I can only capture the visible portion of the window. Is there any way to capture the entire window? specifically the scrolled portion of a window that is

screencapture with PIL question

2008-07-14 Thread greg
I am able to use the PIL module to capture a screen or specific window. My problem is when capturing a window (on windows XP) I can only capture the visible portion of the window. Is there any way to capture the entire window? specifically the scrolled portion of a window that is not visible on

Re: screencapture with PIL question

2008-07-14 Thread Matimus
On Jul 14, 8:11 am, greg [EMAIL PROTECTED] wrote: Is there any way to capture the entire window?  specifically the scrolled portion of a window that is _not_visible_on_the_screen_. I don't think there is. That is why it is called a _screen_ capture. Matt --

Easy PIL question

2008-02-16 Thread Adam W.
I know there is an easy way to do this, but I can't figure it out, how do I get the color of a pixel? I used the ImageGrab method and I want to get the color of a specific pixel in that image. If you know how to make it only grab that pixel, that would also be helpful. Basically I'm trying to

Re: Easy PIL question

2008-02-16 Thread Gary Herron
Adam W. wrote: I know there is an easy way to do this, but I can't figure it out, how do I get the color of a pixel? I used the ImageGrab method and I want to get the color of a specific pixel in that image. If you know how to make it only grab that pixel, that would also be helpful.

Re: Easy PIL question

2008-02-16 Thread bearophileHUGS
Gary Herron: Try image.getpixel((x,y)) to retrieve the pixel at (x,y). If the OP needs to access many pixels, then he can use the load() method on the image object, and then read/write pixels (tuples of 3 ints) using getitem [] import Image im = Image img = im.load() img[x,y] = ... ... =

Re: PIL question

2008-01-09 Thread Fredrik Lundh
Alex K wrote: Would anyone know how to generate thumbnails with rounded corners using PIL? I'm also considering imagemagick if PIL turns out not to be appropriate for the task. create a mask image with round corners (either with your favourite image editor or using ImageDraw/aggdraw or some

Re: PIL question

2008-01-09 Thread Fredrik Lundh
Fredrik Lundh wrote: create a mask image with round corners (either with your favourite image editor or using ImageDraw/aggdraw or some such). and for people stumbling upon via a search engine some time in the future, Stani just posted a complete example over at the image-sig mailing list.

Re: PIL question

2007-11-16 Thread Thomas Heller
Thomas Heller schrieb: I'm trying to read an image with PIL, crop several subimages out of it, and try to combine the subimages again into a combined new one. This is a test script, later I want to only several single images into a combined one. [...] Here is the code; I'm using Python 2.4

Easy PIL Question?

2006-10-30 Thread [EMAIL PROTECTED]
I want to do something very simple: I want to read a palette image (256 color PNG or BMP for instance), and then just to output the image data as numbers (palette indexes, I guess). Makes sense? How do I do that? /David -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy PIL Question?

2006-10-30 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: I want to do something very simple: I want to read a palette image (256 color PNG or BMP for instance), and then just to output the image data as numbers (palette indexes, I guess). it's explained in the documentation, of course:

Re: Easy PIL Question?

2006-10-30 Thread [EMAIL PROTECTED]
Fredrik Lundh wrote: it's explained in the documentation, of course: http://effbot.org/imagingbook/image.htm#Image.getdata But as I read it, this gives me pixel values, i.e. colors. I want palette indexes instead (which is what is really stored in a palette image). I guess I can make a

Re: PIL question about crop method

2006-04-05 Thread Diez B. Roggisch
John Salerno schrieb: I might be way off target even looking into this method for what I need to do, but I'm still a little confused about the description of it: crop im.crop(box) = image Returns a rectangular region from the current image. The box is a 4-tuple defining the left,

Re: PIL question about crop method

2006-04-05 Thread Gary Herron
John Salerno wrote: I might be way off target even looking into this method for what I need to do, but I'm still a little confused about the description of it: crop im.crop(box) = image Returns a rectangular region from the current image. The box is a 4-tuple defining the left, upper, right,

Re: PIL question about crop method

2006-04-05 Thread John Salerno
Diez B. Roggisch wrote: Alternatively you can see it as boundary lines, in the order left, top, right, bottom. (10, 20, 30, 100) So in the above, from where are the numbers being counted? 10 is ten pixels from the left border of the image? 20 is twenty pixels from the top border? But is

Re: PIL question about crop method

2006-04-05 Thread John Salerno
John Salerno wrote: Diez B. Roggisch wrote: Alternatively you can see it as boundary lines, in the order left, top, right, bottom. (10, 20, 30, 100) So in the above, from where are the numbers being counted? 10 is ten pixels from the left border of the image? 20 is twenty pixels from

Re: PIL question about crop method

2006-04-05 Thread Philippe Martin
Yes John Salerno wrote: John Salerno wrote: Diez B. Roggisch wrote: Alternatively you can see it as boundary lines, in the order left, top, right, bottom. (10, 20, 30, 100) So in the above, from where are the numbers being counted? 10 is ten pixels from the left border of the

Re: PIL question about crop method

2006-04-05 Thread Gary Herron
John Salerno wrote: John Salerno wrote: Diez B. Roggisch wrote: Alternatively you can see it as boundary lines, in the order left, top, right, bottom. (10, 20, 30, 100) So in the above, from where are the numbers being counted? 10 is ten pixels from the left border of the

Re: [PIL]: Question On Changing Colour

2005-10-17 Thread Terry Hancock
On Thursday 13 October 2005 02:58 pm, Andrea Gavana wrote: # that is the old colour -- GREY rgb_old = (0.7, 0.7, 0.7) So, no matter what colour I choose as a new colour, the Hue part of the new colour doesn't change in RGB. In other words, leaving the old value for Saturation and Value

Re: [PIL]: Question On Changing Colour

2005-10-14 Thread Iain King
Andrea Gavana wrote: I have tried your solution, Terry: new_hue # your 'basic color', just the hue part rgb_base # color from the basic button image rgb_new # the new color you want to replace rgb_base with rgb_new = hsv_to_rgb( (new_hue,) + rgb_to_hsv(rgb_base)[1:]) thanks a

Re: [PIL]: Question On Changing Colour

2005-10-14 Thread Scott David Daniels
Confusion about applying hue to a grey value Try this: import colorsys as cs grey = (.7, .7, .7) blue = (0., 0., 1.) hsv_grey = cs.rgb_to_hsv(*grey) hsv_blue = cs.rgb_to_hsv(*blue) hsv_grey (0.0, 0.0, 0.69996) hsv_blue (0.3, 1.0, 1.0) The problem is that

Re: [PIL]: Question On Changing Colour

2005-10-13 Thread Andrea Gavana
I have tried your solution, Terry: new_hue # your 'basic color', just the hue part rgb_base # color from the basic button image rgb_new # the new color you want to replace rgb_base with rgb_new = hsv_to_rgb( (new_hue,) + rgb_to_hsv(rgb_base)[1:]) thanks a lot for your suggestion!

Re: [PIL]: Question On Changing Colour

2005-10-11 Thread Terry Hancock
On Wednesday 12 October 2005 05:28 pm, Andrea Gavana wrote: Now my question: is it possible to transform the pixels colours in order to have another basic colour (say blue)? In other words, the predominant colour will become the blue, with other pixels in a brighter or darker blue to give the

Re: [PIL]: Question On Changing Colour

2005-10-11 Thread jepler
If you're always going from grey to tinted, then the easiest way is to treat it as a 'P' image with a special palette. I believe this function will prepare the palette: def make_palette(tr, tg, tb): l = [] for i in range(255): l.extend([tr*i / 255,

A PIL Question

2005-08-14 Thread Ray
Hello, I'm using latest PIL version with Python 2.4.1. (for solving a level in Python Challenge actually...). Anyway, I'm trying to draw a picture. My question is, why is it that putdata() won't work? Even this won't run: import Image im = Image.open(something.jpg) seq = im.getdata() image =

Re: A PIL Question

2005-08-14 Thread Terry Hancock
On Sunday 14 August 2005 12:34 pm, Ray wrote: import Image im = Image.open(something.jpg) seq = im.getdata() image = Image.Image() image.putdata(seq) image.show() I always get: Traceback (most recent call last): File Script1.py, line 31, in ? image.putdata(seq) File

Re: A PIL Question

2005-08-14 Thread Max Erickson
Ray [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: image = Image.Image() Anybody has any idea why this is the case? Image.Image() isn't the way to get a new image object in PIL. Try Image.new(), which needs at least mode and size arguments. You can get those from your original

Re: A PIL Question

2005-08-14 Thread Cyril Bazin
Try Image.new in place of Image.Image if you want to build a new image. At which level are you? CyrilOn 14 Aug 2005 10:34:38 -0700, Ray [EMAIL PROTECTED] wrote: Hello,I'm using latest PIL version with Python 2.4.1. (for solving a level inPython Challenge actually...). Anyway, I'm trying to draw

Re: PIL question: keeping metadata

2005-07-03 Thread Jarek Zgoda
Ilpo Nyyssönen napisał(a): Is there any way of keeping this info in PIL? I don't think so... when I investigated in the past, I think I discovered that the PIL can't write EXIF data (I might be wrong, though, or my information might be outdated). There is this:

Re: PIL question: keeping metadata

2005-06-29 Thread Will McCutchen
Is there any way of keeping this info in PIL? I don't think so... when I investigated in the past, I think I discovered that the PIL can't write EXIF data (I might be wrong, though, or my information might be outdated). Alternatively, is there a simple image processing package that does it?