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

383 questions
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
  • 426
  • 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
2 answers

Save a singleframe with Wand

I'm getting a problem with my little script. I want to use wand in order to convert PDF file on jpeg file and I would like to save juste one particular frame. My script makes 2 things : If the PDF document makes one page : convert and save it into…
user6051274
5
votes
2 answers

How to change the convert command to python code

I'm using Imagemagick for image enhancement in my project. As I'm a newbie to Imagemagick, I have started it with using command line argument for this package. For further processing, I need to change the below command into python code. convert…
Vijesh Venugopal
  • 1,621
  • 15
  • 26
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
  • 542
  • 1
  • 5
  • 20
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
1 answer

How to convert this command to a python code using Wand & ImageMagick

I want to convert an image so I can read it better using pyocr & tesseract. The Command line I want to convert to python is : convert pic.png -background white -flatten -resize 300% pic_2.png Using python Wand I managed to resize it but I don't…
Aysennoussi
  • 3,720
  • 3
  • 36
  • 60
5
votes
3 answers

imagemagick wand save pdf pages as images

I would like to use imagemagick Wand package to convert all pages of a pdf file into a single image file. I am having the following trouble though (see comments below which highlight problem) import tempfile from wand.image import Image with…
Rich Tier
  • 9,021
  • 10
  • 48
  • 71
4
votes
1 answer

How to convert a PDF to a JPG/PNG in Python with the highest possible quality?

I am tying to convert a PDF to an image so I can OCR it. But the quality is being degraded during the conversion. There seem to be two main methods for converting a PDF to an image (JPG/PNG) with Python - pdf2image and ImageMagick/Wand. #pdf2image…
samiles
  • 3,768
  • 12
  • 44
  • 71
4
votes
1 answer

Why does my Python code work in Jupyter Notebook but not as a script?

I'm trying to open up a PDF as an image using Wand. If I run the code below in Jupyter Notebook, it works fine. If I run the code as a script from Command Prompt, I get an error message. For some reason, the module won't load when it's run…
sprand
  • 43
  • 4
4
votes
1 answer

Make a GIF play exactly once with Python Wand

I can create an animated GIF like this: from wand.image import Image with Image() as im: while i_need_to_add_more_frames(): im.sequence.append(Image(blob=get_frame_data(), format='png')) with im.sequence[-1] as frame: …
Maya
  • 1,490
  • 12
  • 24
4
votes
2 answers

How to create high res JPEG with Wand from binary string

I'm trying to convert some PDFs to high res jpegs using imagemagick . I'm working on win 10, 64 with python 3.62 - 64 bit and wand 0.4.4. At the command line I have : $ /e/ImageMagick-6.9.9-Q16-HDRI/convert.exe -density 400 myfile.pdf -scale…
user1592380
  • 34,265
  • 92
  • 284
  • 515
4
votes
2 answers

Wand + ImageMagick + Anaconda: "'wand' has no attribute 'image'"

I'm having issues using these three together. I believe wand is not recognizing the ImageMagick libraries but I'm not sure. Environment: Python 3.5.1 :: Anaconda 4.0.0 (64-bit) Windows 7 Set up instructions I took: Installed ImageMagick-6.9.4-Q8…
DataDude
  • 69
  • 1
  • 7
4
votes
1 answer

Wand does not work under python 64 bit and imagemagick 64 bit: cannot find shared libraries

I am running python 2.7 64bit on windows and have installed imagemagick 64 bit (latest version available) with the necessary headers and env variables as stated in the guide. Unfortunately I am able to install wand via pip but as soon as I try to…
AleN
  • 75
  • 1
  • 5
4
votes
1 answer

Why does resizing a JPEG image using PIL, increases file size?

I have written a Python code which resizes an image into a max 1200 x 1200 frame, maintaining the aspect ratio. I am coming across this case where the input image(1080 x 1350) is 249.8KB whereas the output image(960 x 1200) is 317.2KB. This is…
Sagnik Sinha
  • 873
  • 1
  • 11
  • 22
1 2
3
25 26