Hi i have a problem.
def showimage(req):
from PIL import Image
im=Image.open("c:\image-2.jpg")
im.thumbnail((800,600), Image.ANTIALIAS)
req.sendfile(im)
give me some error.
How can i return this image witdhout save ? 5 1320
Abandoned wrote:
Hi i have a problem.
def showimage(req):
from PIL import Image
im=Image.open("c:\image-2.jpg")
im.thumbnail((800,600), Image.ANTIALIAS)
req.sendfile(im)
give me some error.
Really? I don't see any error. So there can't be one.
Diez
On Nov 19, 12:36 pm, "Diez B. Roggisch" <de...@nospam.web.dewrote:
Abandoned wrote:
Hi i have a problem.
def showimage(req):
from PIL import Image
im=Image.open("c:\image-2.jpg")
im.thumbnail((800,600), Image.ANTIALIAS)
req.sendfile(im)
give me some error.
Really? I don't see any error. So there can't be one.
Diez
It gives me this error:
req.sendfile(im)
TypeError: argument 1 must be string, not instance
Sendfile uses as:
req.sendfile("C:/img.jpg")
But i don't know how can i return when i use PIL before return ?
Abandoned wrote:
On Nov 19, 12:36 pm, "Diez B. Roggisch" <de...@nospam.web.dewrote:
>Abandoned wrote:
Hi i have a problem.
def showimage(req):
from PIL import Image
im=Image.open("c:\image-2.jpg")
im.thumbnail((800,600), Image.ANTIALIAS)
req.sendfile(im)
give me some error.
Really? I don't see any error. So there can't be one.
Diez
It gives me this error:
req.sendfile(im)
TypeError: argument 1 must be string, not instance
Sendfile uses as:
req.sendfile("C:/img.jpg")
But i don't know how can i return when i use PIL before return ?
Then don't use sendfile. I don't know mod_python, but I'm pretty sure you
can output what you want somehow to the output stream. So, do that.
Or go down the easy road, create a temp-file to store the image and send
that.
Diez
On Nov 19, 5:32 pm, "Diez B. Roggisch" <de...@nospam.web.dewrote:
Abandoned wrote:
On Nov 19, 12:36 pm, "Diez B. Roggisch" <de...@nospam.web.dewrote:
Abandoned wrote:
Hi i have a problem.
def showimage(req):
from PIL import Image
im=Image.open("c:\image-2.jpg")
im.thumbnail((800,600), Image.ANTIALIAS)
req.sendfile(im)
give me some error.
Really? I don't see any error. So there can't be one.
Diez
It gives me this error:
req.sendfile(im)
TypeError: argument 1 must be string, not instance
Sendfile uses as:
req.sendfile("C:/img.jpg")
But i don't know how can i return when i use PIL before return ?
Then don't use sendfile. I don't know mod_python, but I'm pretty sure you
can output what you want somehow to the output stream. So, do that.
Or go down the easy road, create a temp-file to store the image and send
that.
Diez- Hide quoted text -
- Show quoted text -
Thank you very much.
Yes if i save this i show with sendfile but i must show this witdhout
save.
Abandoned wrote:
Hi i have a problem.
def showimage(req):
from PIL import Image
im=Image.open("c:\image-2.jpg")
im.thumbnail((800,600), Image.ANTIALIAS)
req.sendfile(im)
give me some error.
How can i return this image witdhout save ?
image = Image.open(...)
image.thumbnail(...)
req.content_type = "image/jpeg"
image.save(req, "jpeg")
Peter This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Christoph |
last post by:
Hi,
I have a script I pass (from Zope) an image file to, to do some PIL image stuff
with it. I want a StringIO instance representing the altered image file to be
returned. What is the method to...
|
by: Scott Brady Drummonds |
last post by:
Can anyone recommend the easiest way of generating thumbnail images using a
Python library? I've seen that the Python Image Library (PIL) seems to do
this but it isn't installed on my available...
|
by: haddock |
last post by:
hi all
Is it possible to access the size (with and height) of a .tga image in
python? From the documentation I would say no, but I'm pretty new to
python...
if the answer really is no, has...
|
by: PyPK |
last post by:
Hi I am looking for a simple tiff Image reader/writer in python.Can
anyone point me to the right one.
|
by: flaerpen |
last post by:
Hi, I'm trying to use the function paste() to paste a image into another image but I can't get it work! Is it the right function to use or is there any other function that's better?
Here's my very...
|
by: Abandoned |
last post by:
Hi..
I want to show the pictures with mod python directly.
def showimage(req):
some process...
open /var/www/a.jpg and print
for example if i open:
domain.com/a.py/showimage
It must show...
|
by: Independent |
last post by:
Python programmers may find the application to decoding an encrypted map
image format known as Memory Map to produce a standard PNG image file
interesting.
Someone obviously very well versed in...
|
by: norseman |
last post by:
Daniel de Sousa Barros wrote:
================================================
Click Start/settings/control panel/system/advanced/settings(in \
performance area)/advanced/change
set System...
|
by: zandrew |
last post by:
Hello there everyone. For a summer project I'm doing, I have to use a phone to pass an image I've taken (on the phone) to a dedicated server I've made on a local ubuntu machine. For the upload code,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
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,...
| |