how do you import an image into python without external software? - image

This is for primary school students who only have access to the main software, not Pygame or Tkinkter or any of that. This is a group of people named LPPJJAS sending this message and we woud like a code return.

Tkinter is documented as a standard Python library module. See the official documentation here. Tkinter is primarily a user interface widget toolkit rather than than an image processing library anyway, although one can display images in it.
But if for some reason Tkinter is not acceptable, the Pillow fork of the Python Imaging Library is probably the simplest option for an image processing library.
It's not a part of the base language but is maintained at the Python foundation's package index.
Executable installers for Pillow, for Windows and Python 2.7, as well as Python eggs and Python wheels (for Windows and other OS's), and setup instructions, can be found at the Pillow 2.9.0 official site. Choose the one appropriate to your version of Windows (32 or 64 bit) for Python 2.7.
There is also some documentation on the library itself at that site.

Related

When tkinter.PhotoImage works with png files, why use pillow?

I have seen many tkinter tutorials on images and almost all of them say that you have to use pillow to read png images, but tkinter.PhotoImage also does the job. Has there been a recent update to tkinter.PhotoUpdate or is there another reason for using pillow?
Has there been a recent update to tkinter.PhotoUpdate or is there another reason for using pillow?
Yes, there has been a fairly recent update to tkinter. PNG support is fairly recent, and still not available in every version of tkinter. You need a version of tkinter that is built on top of tk 8.6 or later.
You can check your version of tk by looking at the TkVersion attribute of the tkinter module:
import tkinter as tk
print(f"tk version: {tk.TkVersion}")

How and which graphing library to install on Python 3

I have Python 3 on OSX Yosemite installed with Brew. I want to make some simple charts (like in Excel). I run Python from bash. Which library should I investigate, and the proper way to have it installed? I am looking for library which is easy to install, and then easy to use. Output probably png files?
matplotlib is a good choice.
How to install it on OS-X is mentioned in the installation FAQ.
Especially in combination with IPython notebooks it gives you a nice interactive environment to play with it.
Another alternative would be gnuplot. Pre-built packages are available.
It is not tied to Python, it is basically a domain specific language for graphing. There are python bindings available, gut it is also not difficult to use it with subprocess.
If you can use commercial libraries, you may also consider ChartDirector.

include pygame in your program

I'm about to finish a program which uses Pygame, which means you would need to install Python and Pygame in order to run the game. How can I include Python and Pygame in the program itself, or is there an easy way to make an installer for the game?
py2exe seems to be a popular answer, and I would suggest looking into it as well. I would also suggest trying pyinstaller. The setup is a bit more involved, but the tutorials are great.
Like PygameNerd said, I would suggest looking into py2exe. I wrote a game for a game jam and wanted to distribute it to people in my dorm. I used py2exe to load it up and distribute it pretty effortlessly (especially using Pygame).
Check out the py2exe website as well as this link on working with various modules in your package. I had dependencies with wxPython and used the latter guide to much success.

Using python library for GIST feature extraction on Windows

I just started using Python (version 2.7.2) on Windows 7.
I want to use GIST feature in my python project. I have been looking around for the GIST python library. There is a famous library called pyleargist (http://pypi.python.org/pypi/pyleargist/1.0.1#downloads).
However, I have tried so many ways to build and install this library on Windows7. Unfortunately, it didn't success at all. Therefore, I would like to ask 2 questions here.
Is there any other alternative python library (apart from pyleargist or writing it myself) for GIST image descriptor?
Have any of you ever been able to use pyleargist library for any Python 2.7 code on Windows7?
Thanks

Are there image processing modules for Python 3?

I am facing an image processing task, and I'm using Python 3.2 (on a 64-bit Windows system). All my searches for image processing libraries have come up with are libraries for older versions of Python (most notably PIL, whose current version - 1.1.7 - supports Python 2.7). Does anyone know of an image processing library for Python 3?
By the way, I do not need fancy transformations and heavy stuff. All I need is to open a JPG file and get the image as an RGB-value matrix/list.
Any help will be most appreciated!
You can get a source version of PIL which will compile on python3.1 here:
https://github.com/sloonz/pil-py3k
also binary installer for 3.2 and 64-bit windows here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil
ref: Image library for Python 3
The world is changing and everyone seem to be moving to a brand new library: Pillow. It is a drop-in replacement for PIL but it is alive and does support Python 3.

Resources