id
stringlengths
16
145
text
stringlengths
1
179k
title
stringclasses
1 value
Python_StringIO/1006_349_0.txt
### Footer navigation
Python_StringIO/Python_StringIO_1_0.txt
## Text Encoding ¶ The default encoding of ` TextIOWrapper ` and [ ` open() ` ](functions.html#open "open") is locale-specific ( [ ` locale.getencoding() ` ](locale.html#locale.getencoding "locale.getencoding") ). However, many developers forget to specify the encoding when opening text files encoded in UTF-8 ...
Python_StringIO/1006_23_0.txt
# Search code, repositories, users, issues, pull requests...
Python_StringIO/1006_200_0.txt
so with that said, how do I make the local instance global in pillow.py??
Python_StringIO/2205_39_0.txt
You signed in with another tab or window. [ Reload ]() to refresh your session. You signed out in another tab or window. [ Reload ]() to refresh your session. You switched accounts on another tab or window. [ Reload ]() to refresh your session. Dismiss alert
Python_StringIO/1006_74_0.txt
f = open('test.png','wb'); f.write( string(0) ); f.close()
Python_StringIO/25046pilhowreturnstr_76_0.txt
Hallo. I have Zope 2-7-0 on Linux platform and the following problem :) I'm sending an image through form on the pythonScript. I want script to resize image and save on the zope folder in 3...
Python_StringIO/1006_50_0.txt
Already on GitHub? [ Sign in ](/login?return_to=%2Fpython- pillow%2FPillow%2Fissues%2Fnew%2Fchoose) to your account
Python_StringIO/1006_169_0.txt
###
Python_StringIO/1006_337_0.txt
Labels
Python_StringIO/2205_94_0.txt
It worked! A dev friendly exception would be appreciated though. I've lost tons of time with this problem...
Python_StringIO/2205_12_0.txt
By Solution
Python_StringIO/1006_302_0.txt
---
Python_StringIO/25046pilhowreturnstr_112_0.txt
[ C / C++ ](https://bytes.com/topic/c/answers/)
Python_StringIO/25046pilhowreturnstr_44_0.txt
>>> image.save('test', 'JPEG') > image=StringIO(image.????()) # what's the right method? > return image > > Any hints? Thanx! >>
Python_StringIO/1006_268_0.txt
There is an amd64 egg, [ https://pypi.python.org/packages/2.7/P/Pillow/Pillow-2.6.1-py2.7-win- amd64.egg#md5=01ccce87ee8f7e7385f904e6cbbb13a4 ](https://pypi.python.org/packages/2.7/P/Pillow/Pillow-2.6.1-py2.7-win- amd64.egg#md5=01ccce87ee8f7e7385f904e6cbbb13a4)
Python_StringIO/25046pilhowreturnstr_39_0.txt
[ ](https://bytes.com/)
Python_StringIO/1006_286_0.txt
EDIT3: yep that got my library working, yay, I don't need to break my rules ^_^ (due to the interface of my program, you're not supposed to use "import" in scripts) ^libraries have backend access to my program, while scripts only have frontend (this is why)
Python_StringIO/1006_273_0.txt
Copy link
Python_StringIO/1006_326_0.txt
sorry I'm late to this...
Python_StringIO/1006_86_0.txt
I'd suggest setting up an environment with python and Pillow installed into sys.packages. Do the simplest possible python code to load your image, e.g.:
Python_StringIO/1006_1_0.txt
## Navigation Menu
Python_StringIO/1006_27_0.txt
# Provide feedback
Python_StringIO/775_26_0.txt
if dst_ratio < src_ratio: crop_height = src_height crop_width = crop_height * dst_ratio x_offset = float(src_width - crop_width) / 2 y_offset = 0 else: crop_width = src_width crop_height = crop_width / dst_ratio x_offset = 0 y_offset = float(src_height - crop_height) / 3 img = img.crop((int(x_offset), int(y_offset), in...
Python_StringIO/1006_33_0.txt
Name
Python_StringIO/1006_176_0.txt
python doesn't like to work properly using functions upon functions like I'm doing, which is why it didn't report the error, let's rename PIL to the proper import and try that. :P
Python_StringIO/2205_8_0.txt
* [ All features ](https://github.com/features) * [ Documentation ](https://docs.github.com) * [ GitHub Skills ](https://skills.github.com) * [ Blog ](https://github.blog)
Python_StringIO/1006_59_0.txt
[ ![@Tcll](https://avatars.githubusercontent.com/u/773959?s=80&u=96a793e9582ba5f3f67877b81c28eb43e5c3cec7&v=4) ](/Tcll)
Python_StringIO/25046pilhowreturnstr_25_0.txt
[ ](https://bytes.com/)
Python_StringIO/25046pilhowreturnstr_88_0.txt
[ 2 ](https://bytes.com/topic/python/answers/573044-opening-colour-bmps-pil) [ ](https://bytes.com/)
Python_StringIO/2205_62_0.txt
**[ boskicthebrain ](/boskicthebrain) ** commented Nov 7, 2016 •
Python_StringIO/1006_214_0.txt
Member
Python_StringIO/1006_148_0.txt
I can prbly get rid of the import Image part now... w/o it, the code I have wouldn't work before: (IMG.py)
Python_StringIO/25046pilhowreturnstr_153_0.txt
[ Windows Forms - .Net 8.0 ](https://bytes.com/topic/visual-basic- net/answers/979245-windows-forms-net-8-0-a)
Python_StringIO/2205_100_0.txt
[ ![@boskicthebrain](https://avatars.githubusercontent.com/u/6009760?s=40&u=cc7d886535a70c96874aac53ac20bbd8e99a7f70&v=4) ](/boskicthebrain) [ boskicthebrain ](/boskicthebrain) closed this as [ completed ](/python- pillow/Pillow/issues?q=is%3Aissue+is%3Aclosed+archived%3Afalse+reason%3Acompleted) Nov 7, 2016
Python_StringIO/775_115_0.txt
Copyright © 2011-2024 [ PythonAnywhere LLP ](/about/company_details/) — [ Terms ](/terms/) — [ Privacy & Cookies ](/privacy/)
Python_StringIO/1006_14_0.txt
Resources
Python_StringIO/2205_128_0.txt
No one assigned
Python_StringIO/25046pilhowreturnstr_19_0.txt
[ Fredrik Lundh ](/register/)
Python_StringIO/25046pilhowreturnstr_118_0.txt
[ 0 ](https://bytes.com/topic/general/insights/979213-what-onu)
Python_StringIO/25046pilhowreturnstr_109_0.txt
[ Is that possible of reading the .csv file in column wise and the column have different lengths ? ](https://bytes.com/topic/c/answers/979210-possible- reading-csv-file-column-wise-column-have-different-lengths)
Python_StringIO/775_58_0.txt
@app.route('/test2', methods=['GET']) def test2():
Python_StringIO/1006_220_0.txt
---
Python_StringIO/1006_284_0.txt
EDIT2: just thought of something I can do for optimization and creating a library while getting rid of pillow.py
Python_StringIO/1006_114_0.txt
---
Python_StringIO/1006_12_0.txt
By Solution
Python_StringIO/25046pilhowreturnstr_154_0.txt
by: [ adsilva ](https://bytes.com/profile/564187/adsilva/) | last post by:
Python_StringIO/775_78_0.txt
deleted-user-64250 | 10 posts | July 23, 2013, 6:46 p.m. | [ permalink ](https://www.pythonanywhere.com/forums/topic/775/#id_post_5554)
Python_StringIO/25046pilhowreturnstr_30_0.txt
Jul 18 '05 # [ 3 ](https://bytes.com/topic/python/answers/25046-pil-how- return-stringio-image#post94149 "permalink")
Python_StringIO/1006_323_0.txt
###
Python_StringIO/1006_4_0.txt
[ Sign in ](/login?return_to=https%3A%2F%2Fgithub.com%2Fpython- pillow%2FPillow%2Fissues%2F1006)
Python_StringIO/2205_73_0.txt
from io import StringIO from PIL import Image
Python_StringIO/2205_42_0.txt
* * [ Notifications ](/login?return_to=%2Fpython-pillow%2FPillow) * [ Fork 2.1k ](/login?return_to=%2Fpython-pillow%2FPillow) * [ Star 11.7k ](/login?return_to=%2Fpython-pillow%2FPillow)
Python_StringIO/1006_77_0.txt
The text was updated successfully, but these errors were encountered:
Python_StringIO/775_56_0.txt
def serve_pil_image(pil_img): img_io = StringIO.StringIO() #pil_img.save(img_io, 'JPEG', quality=100) pil_img.save(img_io, 'PNG', quality=100) img_io.seek(0) return send_file(img_io, mimetype='image/png')
Python_StringIO/775_7_0.txt
I have a Flask Web App that loads and manipulates JPEG images. To improve performance I would like to preprocess some of these images using a cron job. While the code works fairly well in a Flask Context, I don't succeed in running the same code from a bash console or through cron. The stack trace I got looks like this...
Python_StringIO/25046pilhowreturnstr_69_0.txt
[ PIL and jpg -> png conversion ](https://bytes.com/topic/python/answers/25128-pil-jpg-png-conversion)
Python_StringIO/2205_45_0.txt
* [ Code ](/python-pillow/Pillow) * [ Issues ](/python-pillow/Pillow/issues) * [ Pull requests ](/python-pillow/Pillow/pulls) * [ Discussions ](/python-pillow/Pillow/discussions) * [ Actions ](/python-pillow/Pillow/actions) * [ Projects ](/python-pillow/Pillow/projects) * [ Wiki ](/python-pillow/Pillow/wiki) * [...
Python_StringIO/1006_101_0.txt
^ best test I can do to verify my interface, which works
Python_StringIO/25046pilhowreturnstr_127_0.txt
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...
Python_StringIO/2205_2_0.txt
Toggle navigation
Python_StringIO/775_91_0.txt
...?
Python_StringIO/1006_109_0.txt
f = open('test.png','rb') data = array.array( 'B', [ord(c) for c in f.read()] ) # my file system, sorta # f2 = open('test2.png','wb'); f2.write( data.tostring() ); f2.close() # test from above im = Image.open(StringIO.StringIO( data.tostring() ))
Python_StringIO/2205_17_0.txt
* [ GitHub Sponsors Fund open source developers ](https://github.com/sponsors)
Python_StringIO/25046pilhowreturnstr_72_0.txt
[ Python ](https://bytes.com/topic/python/answers/)
Python_StringIO/2205_55_0.txt
Closed
Python_StringIO/25046pilhowreturnstr_143_0.txt
[ Access Europe - Using VBA to create a class based on a table - Wed 1 May ](https://bytes.com/topic/access/insights/979232-access-europe-using-vba- create-class-based-table-wed-1-may)
Python_StringIO/25046pilhowreturnstr_134_0.txt
[ General ](https://bytes.com/topic/general/answers/)
Python_StringIO/775_68_0.txt
Yes, your code from **July 22 2013 4:06pm** works fine for me in a bash prompt. For the avoidance of doubt, here is a transcript:
Python_StringIO/2205_22_0.txt
Search or jump to...
Python_StringIO/1006_120_0.txt
###
Python_StringIO/1006_122_0.txt
There are 2 things that stand out as being possible issues:
Python_StringIO/25046pilhowreturnstr_83_0.txt
[ 2 ](https://bytes.com/topic/python/answers/551782-wxpython-pil) [ ](https://bytes.com/)
Python_StringIO/1006_55_0.txt
Closed
Python_StringIO/1006_253_0.txt
tried it in both x86/ and in site-packages/:
Python_StringIO/1006_182_0.txt
screw it, I'll get back to it in the morning...
Python_StringIO/1006_316_0.txt
response = { 'prediction': { 'food': prediction[0][0], 'notfood': prediction[0][1] } } return jsonify(response)
Python_StringIO/1006_19_0.txt
Repositories
Python_StringIO/775_4_0.txt
# Forums
Python_StringIO/25046pilhowreturnstr_9_0.txt
[ Christoph ](/register/)
Python_StringIO/1006_202_0.txt
or is there some other trick you guys know about with PIL??
Python_StringIO/25046pilhowreturnstr_60_0.txt
This thread has been closed and replies have been disabled. Please start a new discussion.
Python_StringIO/1006_42_0.txt
* * [ Notifications ](/login?return_to=%2Fpython-pillow%2FPillow) * [ Fork 2.1k ](/login?return_to=%2Fpython-pillow%2FPillow) * [ Star 11.7k ](/login?return_to=%2Fpython-pillow%2FPillow)
Python_StringIO/25046pilhowreturnstr_7_0.txt
# [ PIL: how to return a StringIO of an Image ](https://bytes.com/topic/python/answers/25046-pil-how-return-stringio-image)
Python_StringIO/1006_57_0.txt
[ Tcll ](/Tcll) opened this issue Nov 12, 2014 · 16 comments
Python_StringIO/1006_333_0.txt
Sorry, something went wrong.
Python_StringIO/1006_197_0.txt
Image.register_open("PNG", PngImagePlugin.PngImageFile, PngImagePlugin._accept) Image.register_save("PNG", PngImagePlugin._save)
Python_StringIO/1006_283_0.txt
but again, my point be made, I'll still have to copy it between interpreters
Python_StringIO/1006_280_0.txt
EDIT:
Python_StringIO/1006_293_0.txt
[ ![@beyondlex](https://avatars.githubusercontent.com/u/7869143?s=80&u=918aeca9957f3d55fea3fe380650670e7372dce9&v=4) ](/beyondlex)
Python_StringIO/1006_92_0.txt
Sorry, something went wrong.
Python_StringIO/1006_9_0.txt
* Solutions
Python_StringIO/775_39_0.txt
![Staff](/static/anywhere/images/staff.png) harry | 2710 posts | PythonAnywhere staff | July 22, 2013, 4:58 p.m. | [ permalink ](https://www.pythonanywhere.com/forums/topic/775/#id_post_5519)
Python_StringIO/775_110_0.txt
![Staff](/static/anywhere/images/staff.png) giles | 12116 posts | PythonAnywhere staff | July 25, 2013, 11:58 a.m. | [ permalink ](https://www.pythonanywhere.com/forums/topic/775/#id_post_5627)
Python_StringIO/1006_150_0.txt
EDIT: commented it out, and sure enough:
Python_StringIO/1006_128_0.txt
Copy link
Python_StringIO/1006_70_0.txt
[ http://stackoverflow.com/questions/25116/binary-buffer-in-python ](http://stackoverflow.com/questions/25116/binary-buffer-in-python)
Python_StringIO/1006_31_0.txt
# Saved searches
Python_StringIO/775_13_0.txt
deleted-user-39880 | 669 posts | July 22, 2013, 1:17 p.m. | [ permalink ](https://www.pythonanywhere.com/forums/topic/775/#id_post_5507)
Python_StringIO/2205_51_0.txt
Jump to bottom