Join Club ShowMeDo to Learn Python!

This series is a part of Club ShowMeDo. Click to learn why you should join our club with a simple monthly subscription.

  • We teach Python and all the cool modules
  • Topics include beginner Python, GUIs, Web and Desktop Apps
  • Long, specially crafted video tutorials just for you
  • Club video tutorials extend our normal Free content
  • Save your time - we've done the research for you
  • Keep your skills up-to-date
  • Learn at your own pace, everything you need is shown to you
  • Over 12 hours of archived material are waiting for you in the club

Name: [002] Ian Ozsvald
Member: 107 months
Authored: 181 videos
Description: I am the co-founder of ShowMeDo (see http://showmedo.com/about), author of `The Screencasting Handbook <http://thescreencastinghandbook.com>`_ and the founder of the professional screencast production company `ProCasts <http://procasts.co.uk>`_: .. image:: http://procasts.co.uk/media/procasts_sma ...

Reading and Writing Binary Files [ID:1352] (4/5)

in series: Python Beginners - File I/O

(Showmedo is undergoing major changes. To report any problems viewing the videos please email us and include browser and OS specifics. Cheers - Kyran.)

Binary files are a large topic. Rather than dwell on Windows-specifics (because Binary files are most relevant to Windows machines) instead I link to a number of examples and then give an example of manipulating a binary image file using the Python Image Library.

First, read up on File objects and see lots of uses in this long file i/o tutorial. Next, if you need the csv library read on the use of 'b' on Windows. Finally, for the example get a jpg image like this SumoBot and install the Python Imaging Library to follow this episode.

"""readwrite_binary.py show PIL binary example for images"""

# File general info including binary 
# http://docs.python.org/library/stdtypes.html#file-objects

# Longer file tutorial
# http://www.penzilla.net/tutorials/python/fileio/

# reader = csv.reader(open("some.csv", "rb"))
# http://docs.python.org/library/csv.html

# sumo robot image:
# http://www.flickr.com/photos/62992529@N00/3098486397
# from Five Pound App Xmas Special: http://fivepoundapp.com/meetup/14/
# of http://robotbrighton.ning.com/

# PIL Image module
# http://www.pythonware.com/library/pil/handbook/image.htm

from PIL import Image
im = Image.open("SumoRobot.jpg")
# quick demo of showing a binary file loaded and manipulated
im.rotate(45).show()

# now make greyscale
#im.draft('L', im.size).show()

#im.draft('L', im.size)
#im.thumbnail((100,75), Image.ANTIALIAS)
#im.show()

#im.save('Sumo_thumbnail.jpg', "JPEG")

Got any questions?

Get answers in the ShowMeDo Learners Google Group.

Video statistics:

  • Video's rank shown in the most popular listing
  • Video plays: 133 (since July 30th)
  • Plays in last week: 0
  • Published: 67 months ago

Thank-yous, questions and comments

If this video tutorial was helpful please take some time to say thank-you to the authors for their hard work. Feel free to ask questions. Let the author know why their video tutorial was useful - what are you learning about? Did the video tutorial save you time? Would you like to see more?

You may also want to see our ShowMeDo Google Group to speak to our active users and authors.

Your email address will not be published.

Show some quick comments >>








All comments excluding tick-boxed quick-comments

I am very new to this entire process. I want to understand what the people who post video binary files go through to get their product. With that in mind is this the place to start?

Thanks

Bob


Excellent content. The only suggestion I would give is to record the video with higher volume - perhaps a lapel mic? I had to turn it up all the way to hear you.


Very nice introduction to binary files and the PIL module.


Very cool! Thank you!

You might consider prompting users for their ideas on small apps that they could create after each of your lessons...

I was thinking about:

*an app that would prompt user for their name and then the image name and then rename the image 'USERNAMEpicture.jpg' file name and then stamp the image with the name. Simple but plenty to learn in just doing that. :)


Great content to get started with on images.


you are an export on screencasting :)


Your video has been edited. This is an automatic post by ShowMeDo.


Showmedo is a peer-produced video-tutorials and screencasts site for free and open-source software (FOSS)- with the exception of some club videos, the large majority are free to watch and download.

how to help » about » faq »

Educating the Open-source Community With Showmedo

Although as important as the software it supports, education and documentation are relatively neglected in the Open-source world. Coders love to code, and explaining how best to use or improve the software tends to be deferred or even sidelined.

At Showmedo we believe the community can play a vital role here and also say thanks for the tools and software that make our lives easier. If you have a piece of software you love or a programming langugage you are enthusiastic about, why not make a screencast showing others how to use it? All the stuff you wish you'd been told, the tips, tricks, insights that would have saved you time and frustration.

Screencasting is easier than you think, and we're happy to help you. You can emailus for advice or just use some of the how-to screencasts on the site. This screencasting learning-pathis a good place to start.

Kudos and Thanks for Ian

Content

Feedback

Showmedo's development is fairly rapid and bugs will inevitably creep in. If you have any problems please drop us a line using the contact address below. Likewise, any suggestions for improvements to the site are gratefully received.

feedback@showmedo.com