Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76210 > unrolled thread

Need simple Python Script

Started bytaifulsust@gmail.com
First post2014-08-13 09:11 -0700
Last post2014-08-13 17:01 -0400
Articles 4 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  Need simple Python Script taifulsust@gmail.com - 2014-08-13 09:11 -0700
    Re: Need simple Python Script Chris Angelico <rosuav@gmail.com> - 2014-08-14 02:17 +1000
    Re: Need simple Python Script John Gordon <gordon@panix.com> - 2014-08-13 17:08 +0000
    Re: Need simple Python Script Terry Reedy <tjreedy@udel.edu> - 2014-08-13 17:01 -0400

#76210 — Need simple Python Script

Fromtaifulsust@gmail.com
Date2014-08-13 09:11 -0700
SubjectNeed simple Python Script
Message-ID<0ec17bee-0ed6-4494-b4ab-2319880315af@googlegroups.com>
Hello Guys

I am new in Python programming.Currently reading the book " Learn Python the Heard Way".However i need a python script which will take an image file (any standard format) from my windows pc as input.Can anybody have any solution?I use command prompt and gedit to learn python.

Thanks

Leon

[toc] | [next] | [standalone]


#76213

FromChris Angelico <rosuav@gmail.com>
Date2014-08-14 02:17 +1000
Message-ID<mailman.12929.1407946660.18130.python-list@python.org>
In reply to#76210
On Thu, Aug 14, 2014 at 2:11 AM,  <taifulsust@gmail.com> wrote:
> I am new in Python programming.Currently reading the book " Learn Python the Heard Way".However i need a python script which will take an image file (any standard format) from my windows pc as input.Can anybody have any solution?I use command prompt and gedit to learn python.
>

If you finish studying the book, you'll have a better idea of how to
go about doing things in Python, and also of how to find out more
about what you can work with. For a start, you probably want a Python
imaging library. You could type those three words into a search engine
and see what comes back. In fact, that's probably a good start for any
question you have.

ChrisA

[toc] | [prev] | [next] | [standalone]


#76217

FromJohn Gordon <gordon@panix.com>
Date2014-08-13 17:08 +0000
Message-ID<lsg62c$rsm$1@reader1.panix.com>
In reply to#76210
In <0ec17bee-0ed6-4494-b4ab-2319880315af@googlegroups.com> taifulsust@gmail.com writes:

> I am new in Python programming.Currently reading the book " Learn Python
> the Heard Way".However i need a python script which will take an image
> file (any standard format) from my windows pc as input.Can anybody have
> any solution?  I use command prompt and gedit to learn python.

What is the script supposed to *do* with the image file?

-- 
John Gordon         Imagine what it must be like for a real medical doctor to
gordon@panix.com    watch 'House', or a real serial killer to watch 'Dexter'.

[toc] | [prev] | [next] | [standalone]


#76237

FromTerry Reedy <tjreedy@udel.edu>
Date2014-08-13 17:01 -0400
Message-ID<mailman.12948.1407963727.18130.python-list@python.org>
In reply to#76210
On 8/13/2014 12:11 PM, taifulsust@gmail.com wrote:

> I am new in Python programming.
 > Currently reading the book " Learn Python the Heard Way".

The title is '... Hard Way'.  This is literally true. The author 'warns' 
beginners to not learn Python 3, which is easier to learn than Python 2, 
and works better in many ways.

Even worse, he warns people not to use Idle (or any other IDE) and use a 
plain text editor like Notepad++ and a terminal to edit and run 
programs.  This is definitely the Hard Way compared to edit and run with 
Idle.  I know from experience, because I started the way he recommends 
(editor and command prompt) and put off learning to use Idle.  What I 
fool I was.

 > However i need a python script which will take
> an image file (any standard format) from my windows pc as input.

Python will read any file as input: bytes are bytes.  Open non-text 
files in binary mode.  For example,

pic = open('image.jpg', 'rb')  # I believe this is the same in 2.x.

However, this is not useful unless you know the file layout and enjoy 
parsing it at the byte level.  Better to use a package that does that 
for you. For doing anything with images, you might use pillow, a 
friendly updated fork of PIL (Python Imaging Library), which works on 
2.6-7 and 3.2-4. I just did
C:\Programs\Python34>pip install pillow
(I have been meaning to do this anyway) and a few seconds later it is 
installed and 'import PIL' works.

For the docs, I had to go back to
https://pypi.python.org/pypi/Pillow/2.5.2
to find the reference to
http://pillow.readthedocs.org/en/latest/

In Idle I added 'pillow' to the help menu, linked to the url above, 
using the options dialog General tab, Additional Help Sources box.

-- 
Terry Jan Reedy

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web