Questions tagged [wand]

The ctypes-based simple ImageMagick binding for Python.

Wand is a ctypes-based simple ImageMagick binding library for Python. It works on Python 2.7, 3.2 through 3.9 and PyPy.

Docs

Community

331 questions
7
votes
3 answers

How to convert multipage PDF to list of image objects in Python?

I'd like to turn a multipage PDF document into a series of image object in list structure, without saving the images in disk (I'd like to process them with PIL Image)in Python. So far I can only do this to write the images into files first: from…
Hendrik
  • 766
  • 3
  • 10
  • 24
7
votes
1 answer

How to optimize image size using wand in python

I want to resize and optimize png and jpg image size using wand. With PIL, I'm able to save the same image with about a 3rd of the size if I specify the optimize option. with open(filename, 'rb') as f: pimage = PImage.open(f) resized_pimage…
nlhma
  • 81
  • 1
  • 3
7
votes
2 answers

Convert from CMYK to RGB

I'm having trouble converting a single page pdf (CMYK) to a jpg (RGB). When I use the code below, the colors in the jpg image are garish. I've tried reading through the Wand docs, but haven't found anything to simply replicate the original image.…
7
votes
1 answer

Python-Wand Sequence Not Clearing From Memory

If I do the following for root, dirs, files in os.walk(myDir): for myFile in files: with Image(filename=myFile) as img: with Image(image=img) as main: print main.sequence[0].width I end up with memory faults using Wand. I'm…
Nertskull
  • 313
  • 3
  • 16
6
votes
4 answers

How to convert a wand image object to numpy array (without OpenCV)?

I am converting pdf files to image using Wand. Then, I do further image processing using ndimage. I would like to directly convert the Wand image into a ndarray... I have seen the answer here, but it use OpenCV. Is this possible without using…
xdze2
  • 3,291
  • 2
  • 8
  • 27
6
votes
1 answer

How to convert wand image object to open cv image (numpy array)

I have imported wand using the following code from wand.image import Image as WandImage from wand.color import Color with WandImage(filename=source_file, resolution=(RESOLUTION,RESOLUTION)) as img: img.background_color = Color('white') …
c.Parsi
  • 741
  • 2
  • 8
  • 24
5
votes
3 answers

Python Wand and ImageMagick on AWS Lambda

Trying to run Wand on AWS Lambda for some simple image manipulation. So far I've: created an instance that's identical to lambda environment installed imagemagick from source wget ImageMagick cd ImageMagick-... ./configure…
deepfritz
  • 416
  • 5
  • 14
5
votes
4 answers

How to reduce wand memory usage?

I am using wand and pytesseract to get the text of pdfs uploaded to a django website like so: image_pdf = Image(blob=read_pdf_file, resolution=300) image_png = image_pdf.convert('png') req_image = [] final_text = [] for img in image_png.sequence: …
5
votes
3 answers

Python converting pdf to image?

So I'm using Wand to try to convert the pdf to an image from wand.image import Image with Image(filename="test.pdf") as img: img.save(filename="/temp.jpg") with Image(filename="test.jpg") as img: img.resize(200, 150) …
Rafas
  • 103
  • 1
  • 1
  • 7
5
votes
2 answers

Can I convert PDF blob to image using Python and Wand?

I'm trying to convert a PDF's first page to an image. However, the PDF is coming straight from the database in a base64 format. I then convert it to a blob. I want to know if it's possible to convert the first page of the PDF to an image within my…
rachiebytes
  • 462
  • 1
  • 5
  • 19
5
votes
3 answers

Save an image generated with wand to django ImageField

I'm trying to generate a preview for an "overlay" config stored in a django model than will be applied later to other model. I have not much experience manipulating files with python... =( Here is my code: import io from django.conf import…
netomo
  • 104
  • 1
  • 7
5
votes
3 answers

Python Wand converts from PDF to JPG background is incorrect

I found a so wired thing while converting a pdf to jpeg, so i'd like to figure out that maybe this is a small bug. See the converted jpg below, you could find that, the background color are all black. The image is here:…
cendy
  • 61
  • 1
  • 3
5
votes
0 answers

Performance of python subprocess vs Wand?

I'm looking for a compute- and memory- efficient way to use ImageMagick in a Python program to retrieve the dimensions of batches of photos. I first used the current favorite ImageMagick-Python package, Wand. I tried it and it felt slow. So I…
Dean Moses
  • 2,292
  • 2
  • 23
  • 35
5
votes
4 answers

ImageMagick to verify image integrity

I'm using ImageMagick (with Wand in Python) to convert images and to get thumbnails from them. However, I noticed that I need to verify whether a file is an image or not ahead of time. Should I do this with Identify? So I would assume checking the…
Kiarash
  • 5,626
  • 7
  • 38
  • 67
5
votes
2 answers

How to install python imagemagick at windows 7. I followed these instruction

To install python IMagick binding wand api on windows 64 bit (python 2.6) This is what I did: downloaded and installed ImageMagick-6.5.8-7-Q16-windows-dll.exe downloaded wand module from http://pypi.python.org/pypi/Wand after that i ran python…
python_dev
  • 51
  • 1
  • 1
  • 3
1
2
3
22 23