can I use wand API in python without installing ImageMagick? - python

I used wand API of ImageMagick in python for ML project ,I want to change my coding file into one executable file so that I can share it to my friends but I got lots of difficulties to pack ImageMagick in one executable file, that's why I want to use wand without ImageMagick.
if you Answer this, then it will help me a lot.
Thankyou. I

Related

Running Tesseract or an alternative OCR module in a python environment without downloading an .exe file

I am looking for an OCR implementation, preferrably in Python that would be able to extract text from a scanned pdf (printed machine written text). However due to a company policy and security reason I am not able to download any executable files (.exe), therefore any Python libraries building upon Tesseract currently don't work for me... Did anybody else also encounter this problem? (I guess its pretty common in big companies). I would be looking for a work-around, either a way to build tesseract without downloading a .exe file or an alternative OCR implementation.
Thanks already!
I am working on a Windows 7 machine..
Unfortunately Pytesseract is only a wrapper around a Tesseract binary (.exe on Windows), so you will probably have to beg and plead your IT to allow it. An option might be to build Tesseract from source yourself, so then you haven't downloaded a "random" .exe...
Another option is, of course, to use an online OCR API, but if security's that tight (and I suppose budgets are too), that might not work for you either.

Is there any way to import a png into python using only modules that come with python 3?

I want to import a png using tkinter. I have seen many tutorials to use PhotoImage but it does not accept the .png file format. Moreover, I cannot use Pillow as this program is for use in my school and my school only has the modules that come with python. Can someone suggest a way to do this?
Tkinter only supports 3 file formats off the bat which are GIF, PGM, and PPM. You will need to convert the files to .GIF then load them in using tkinter.
There are libraries such as Python Imaging Library (PIL), however it might not be allowed in your school to use it.
Hopefully your school allows Photoshop, GIMP or any image editing software to allow you to convert, but I am sure there are plenty of online programs.

Ghostscript necessary for pdf to image conversion using python?

I was trying to convert a pdf to images using a python script and Wand with ImageMagick bindings. But, I really want to avoid using Ghostscript? Is it possible to do because the installation of Wand doesn't mention anything about Ghostscript but it seems that it is mandatory to have the conversion from pdf to an image using python. Has anyone tried doing the same?
There is also a similar issue open in the Wand git repo (https://github.com/dahlia/wand/issues/319). This means that it is really not possible to convert pdf to png without Ghostscript?
Can this be an issue based on OS and ImageMagick version? I am using MacOS and ImageMagick#6. For some reason, I was not able to run the latest ImageMagick(7.1) on Mac. So, if anyone has tried on a different OS or with latest version of ImageMagick, inputs are welcome.
ImageMagick ultimately pipes out to Ghostscript for the conversion.
And poorly as well. I just had this issue a few months ago in PHP script, where crystal reports created badly formed PDF files, that ImageMagick attempts to fix, and throws a java error, but Ghostscript can convert it just fine if ImageMagick is bypassed.
Execute ghostscript with this command line
-dJPEGQ=95 -r600 -dNOPAUSE -q -sDEVICE=jpeg -dBATCH -sOutputFile="OutputImage_%d.jpeg" "SourcePDFPath.pdf" to turn a PDF into multiple jpegs

Creating a standalone project with image recognition

I can't seem to find a way to create a standalone package for image recognition. I have a project I'm writing in python, and I found a way to do what I need using OpenCV, but I can't find a way to import the library into my project unless it is installed at the system level on Ubuntu. In other words, I can't seem to plop the build folder into my project after building the OpenCV library. And I can't find the equivalent of cv2.matchTemplate() in PIL or Pillow. So really there are two questions here.
1) How can I attach the build folder to my project, in order to avoid installing the OpenCV at the system level.
2) Is there an equivalent of cv2.matchTemplate() in PIL or Pillow that I can't seem to find?
Thanks.
You need to:
Download OpenCV
Use CMake to tell it to compile statically and to tell it to compile the Python module
Compile, and install into a directory you want.
Find in that directory the file under a directory called python, called cv2.so
Distribute that file with your Python code.
Now that I told you how to do it, let me tell you why your approach isn't a very good idea:
If the version of Python changes, you need to recompile (the so file) and redistribute your entire application
If the version of OpenCV changes you will need to recompile (the so file) and redistribute your entire application
You don't control what version of Python your users have
There can be important subtleties in version of libjpg, libtiff, zlib and others that could prevent your application from working, all outside your control.
You are converting a multi-platform application into a platform specific solution.

Python Wand on GoogleAppEngine

Anyone know how to use python wand (http://pypi.python.org/pypi/Wand/0.1.10) on google appengine? I've copied the wand directory to my project direcotry but still not working.
The documentation for Wand describes it as a Python binding for the ImageMagick API. So there'd be no point in installing it on App Engine, since ImageMagick itself isn't present.

Categories

Resources