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
3
votes
2 answers

wand - text wrapping - based on the image file size

Hi am trying to write text over an image. But the text overflows. Is there any way to wrap such textual content to fit inside the image? from wand.image import Image from wand.drawing import Drawing from wand.color import Color with…
vjn
  • 33
  • 6
3
votes
2 answers

Render text string to image to calculate length with Wand/ImagaMagick Python

I need to calculate the length when rendered of a lot of strings using a custom font. From a shell script and ImageMagick I am able to do something using the annotate command line option. convert -debug annotate xc: -font "customfont.ttf"…
J T
  • 337
  • 1
  • 3
  • 14
3
votes
2 answers

How to decode JPEG XR files in memory using Python

I'm using Python 3 to process a file produced by microscope, which is essentially a collection of thousands of Jpeg XR compressed images. I need to read all of them into memory. Now I'm reading data in binary mode, saving them in .jxr file and call…
user3667217
  • 2,172
  • 2
  • 17
  • 29
3
votes
1 answer

python wand: change text style with draw.text()

I'm using draw.text() to draw some text on a canvas. But the function only seem to take 3 parameters x, y, and body so there is no way to specify what font, color, etc. Probably I'm missing something here because this is pretty basic functionality.…
lang2
  • 11,433
  • 18
  • 83
  • 133
3
votes
1 answer

Python wand: composite image with transparency

I'm trying to composite two images with Wand. The plan is to put image B at the right hand side of A and make B 60% transparent. With IM this can be done like this: composite -blend 60 -geometry +1000+0 b.jpg a.jpg new.jpg But with Wand I can only…
lang2
  • 11,433
  • 18
  • 83
  • 133
3
votes
0 answers

python: wand autocompress monochromatic image on export. Any workaround?

I'm working on a tool that cuts a large image into smaller tiles using ImageMagick via Python. And I need all the tiles to be on the same format (png, 8 or 16 bits). In most case, it works just fine, but on monochromatic tiles ImageMagick compresses…
3
votes
1 answer

Wand equivalent of ImageMagick "convert -append"

I would like to write the equivalent of convert left.jpg right.jpg +append ouput.jpg I found something like it in another post: files = glob('*.jpg') with Image() as orig: # create empty Image object for f in files: page =…
user4588415
3
votes
0 answers

Python Wand RMSE comparison

Is it possible to do an RMSE image compare with wand? If not with wand, than perhaps another Python/ImageMagick binding?
Hacking Life
  • 3,335
  • 2
  • 19
  • 20
3
votes
2 answers

How to threshold an image using wand in python

using imagemagick I can threshold an image and specify a percentage. convert one.png -threshold 60% two.png How can I do the same using wand in python?
birdy
  • 9,286
  • 24
  • 107
  • 171
2
votes
0 answers

Duplicate `wand` pure pixel stream SHA-256 checksum calculation w/ `hashlib`

What I did was, on one hand: import wand # user-installed img = wand.image.Image(filename=f) print(img.signature) which yields results equivalent to invoking imagemagick in the local shell: import subprocess #…
Cbhihe
  • 511
  • 9
  • 24
2
votes
1 answer

Convert python wand hdr image to numpy array and back

Python wand supports converting images directly to a Numpy arrays, such as can be seen in related questions. However, when doing this for .hdr (high dynamic range) images, this appears to compress the image to 0/255. As a result, converting from a…
Mitchell van Zuylen
  • 3,905
  • 4
  • 27
  • 64
2
votes
2 answers

wand.image Import Error: shared library not found. You probably had not installed ImageMagick library

I am attempting to use the PDFPlumber library, which uses Wand's image format. However, upon trying to run: from wand.image import Image I get this error: Traceback (most recent call last): File…
Moe
  • 21
  • 1
2
votes
1 answer

Defining morphology:compose for merging results of a multi-morphology kernel using Wand

I'm trying to remove lines from an image using the method outlined in this answer: https://stackoverflow.com/a/46533742, but I want to do so using the python Wand library. So far, I have with Image(filename=file_path) as img: …
emccords
  • 95
  • 1
  • 3
2
votes
1 answer

Converting multipage PDF to TIFF does not work with Python library Wand

Given the short, 5 page PDF file (attached at the bottom), and the following python code to convert to a multi-page TIFF: from wand.image import Image with Image(filename='5-page-pdf.pdf', resolution=200) as img: img.type = "grayscale" …
Bryant
  • 3,011
  • 1
  • 18
  • 26
2
votes
1 answer

Convert image magick command to wand-py code

I'm trying to achieve following imagemagick command in pyhon using wand-py my original convert command is convert ./img_1.png ( -clone 0 -colorspace SRGB -resize 1x1! -resize 569x380\! -modulate 100,100,0 ) ( -clone 0 -fill gray(50%) -colorize 100…
anon