Are there image processing modules for Python 3? - image

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.

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 do you import an image into python without external software?

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.

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

What do the optional libraries in the OpenCV build provide?

I am trying to build OpenCV from source (latest SVN trunk) and there are several "optional" dependencies, which will amount to several gigabytes of downloading on their own, especially with the Qt Framework.
For example:
CUDA
GHOSTSCRIPT
MIKTEX
PYTHON
EIGEN
IPP
JASPER
JPEG
OPENEXR
OPENNI
PNG
QT
QT_OPENGL
TBB
TIFF
VIDEOINPUT
XIMEA
Can someone provide a list of what each of these external things provides - ranked by importance? (Sometimes subjective answers are the most insightful answers.) Which ones are built in the binary distribution?
Usually you can leave all the flags in default state unless you need to enable or disable some special features. All really important libraries are already there.
Options you listened can be split into several groups:
Image input/output
Actually OpenCV comes with a copy of these libraries for platforms where these libraries are missed (like Windows or Android).
TIFF
JASPER - jpeg2000 format
JPEG
PNG
OPENEXR - this one is not included into OpenCV
Video IO
VIDEOINPUT - video IO API for Windows platform. Since version 2.3.0 OpenCV embeds it and this flag is useful only to exclude videoinput library from build.
OPENNI - driver for Kinect
XIMEA - API for XIMEA cameras
Libraries of performance primitives
IPP - few dozens of OpenCV functions have IPP accelerated versions.
TBB - OpenCV has a number of functions parallelized with Intel TBB library.
EIGEN - some math functions (like SVD) can use power of Eigen library but OpenCV always provides alternative implementation.
GPU acceleration
CUDA - OpenCV comes with gpu module having a lot of functions accelerated with NVIDIA CUDA technology. If CUDA SDK is not found, then all functions degrade to CPU implementation.
Enhanced GUI
QT - OpenCV GUI functions (like imshow) has a QT version. Without QT they will default to native OS interfaces. (In case of Windows it will be WinAPI).
QT_OPENGL
Bindings to other languages
PYTHON - also build bindings for Python language
Building documentation
GHOSTSCRIPT - obsolete in 2.3.x (does not affect build)
MIKTEX - Windows only. Used to generate documentation in PDF format
Actually this is just a partial answer to your question. You have listened less than half of the options that can be set on OpenCV configuration step - other half is hidden because those options are not available for your platform.

SVG Converting using ImageMagick doesn't apply a translation correctly

I am on a Mac using Mac OS X 10.5, and I am trying to use ImageMagick to convert an SVG file to a PNG. The problem is when I use it the rotated image doesn't show up in the correct position. If I use Batik to convert the file, it works properly.
After doing some research I found a thread that talked about trying to upgrade the SVG library. Currently, I am using ImageMagick 6.6.5 and the SVG library is 2.7.7 according to "identify -list format". The thread I found recommended using librsvg 2.32.
I have tried using port to install the updated SVG library and using port to reinstall ImageMagick. The problem and the question I have is no matter what I do with port I can't get it to use the newer version of the SVG library. It stays at 2.7.7. How do I get it to use the new library?
Unfortunately, I went down this path for a while too. After a very long time beating my head against the wall and getting fairly bruised in the process, I found the only thing that worked was inkscape. Everything else just doesn't pull it off. Unfortunately, inkscape's CLI interfaces aren't great and don't offer you nearly as much flexibility as you'd like (especially when converting to PDFs, etc), it does at least work better than everything else. To use it:
inkscape -f INPUT.SVG -e OUTPUT.PNG
See inkscape --help for aditional details.
Extra word of warning: inkscape -h actually doesn't do what you want for help and launches the GUI.
I was experiencing this on 10.7, having installed imageMagick via macPorts. After trying and failing a couple of uninstall/reinstalls with differing options. I finally uninstalled and built from source, after installing librsvg, and now everything works using the updated svg libraries.
ImageMagick's unix source and instructions are here:
http://www.imagemagick.org/script/install-source.php
ImageMagick also provides instructions on linking libraries and library paths explicitly in your configuration step (http://www.imagemagick.org/script/advanced-unix-installation.php) although I didn't have to do this.

Resources