Questions tagged [wand]
The ctypes-based simple ImageMagick binding for Python.
382
questions
1
vote
1
answer
32
views
stretch draw text with Python Wand
I am exploring how to get some image manipulation done with Python Wand.
I would like to know how to do a "stretch draw": fit a text with the boundaries of a certain box. In Delphi, this ...
1
vote
0
answers
60
views
Python Wand auto rotate and deskew not working
I have a medical form page that is not properly oriented (it's rotated 90 degrees clockwise) and it has text skew. I want to use Wand methods to auto orient the page to be human legible, and also to ...
0
votes
0
answers
45
views
AttributeError: type object 'Image' has no attribute 'fromarray'
I am using Jupyter to run my python code and I am getting "AttributeError: type object 'Image' has no attribute 'fromarray'". Please see my code below:
Cell In[1], line 99, in find_text(...
0
votes
1
answer
28
views
How to apply a unified absolute distortion map via Python/Wand
How can I apply ImageMagick’s unified distortion map via Python/Wand?
IM documentation:
https://www.imagemagick.org/Usage/mapping/#distortion_maps
How it works in a shell script (IM 6.9):
convert &...
0
votes
0
answers
26
views
wand 0.6.11 constructor running in the context of squish requires 2 constructor arguments. Which arguments?
wand 0.6.11 running in the context of squish with python 3.8 seems to require 2 constructor arguments. Which arguments?
I want to use wand.image to compare the result of an image export function of a ...
0
votes
0
answers
132
views
Python/Wand: wand.image Import Error: shared library not found
I'm using Buildroot 2023.2 to create an OS image (linux) for a Raspberry Pi Zero W (i.e., Arm). ImageMagick is an included package for BR, but Wand isn't. I used BR's scanpi utility, which basically ...
0
votes
2
answers
37
views
How does the degree tuple in wand's draw.arc work? Advanced math? Sorcery?
wand's draw.arc takes three arguments:
starting coordinates
ending coordinates
a "pair which represents starting degree, and ending degree"
What is the underlying math being used here? ...
0
votes
1
answer
28
views
Why is wand ignoring my unicode characters in text output?
When I use characters such as ≛, ★, etc., wand ignores them in text output. For example:
#!/usr/bin/python3
import os
import wand
from wand.image import Image
from wand.drawing import Drawing
from ...
0
votes
0
answers
28
views
Python Wand ImageMagick missing some digital signatures
I am using Wand to work on PDFs, and when I open a document with a digital signature (only certain types, DocuSign and Adobe show up, but some others don't) the signature is missing. I read one post ...
0
votes
1
answer
166
views
Wand to create a drop shadow
Background:
I have been trying to implement image enhancement using wand library to add drop shadow to a SingleImage.
I was able to create drop-shadow using ImageMagick CLI, but want to replicate ...
1
vote
1
answer
186
views
Python(Pillow) or JS(canvas) - how to split image and make a right canvas edge as a mirror wrap
I'm trying to split image into pieces and get the same effect as on the photo below using HTML, CSS and JS or with python lib Pillow.
Original image:
input
Result:
result
What I have tried so far is ...
0
votes
1
answer
92
views
How can I use pango (HTML subset) with the ImageMagick Python library wand?
My goal is to take a picture and add a centered text to its center. I want to use italics and bold for this text, specified with the HTML-like pango.
I currently have this code:
import os
from wand....
1
vote
1
answer
191
views
ImageMagick memory consumption becomes 1.4 GB when trying to open an 876 kb animated gif
I'm trying to read an animated gif with ImageMagick. The file in question is available online, located here.
My code (linked with ImageMagick/MagickWand 7) is
#include <stdlib.h>
#include <...
0
votes
2
answers
345
views
Create a multi layer tiff without visible modification in wand/imagemagic/python/js
I need to create a multi layer tif and when I open in photoshop in need to be as separated layers like in the picture:
I need to do it without photoshop so I though so that I can do with Wand in ...
0
votes
1
answer
68
views
Draw text around image in semicircular path in Python
I need to write/draw some text of the objects in an image around semicircular path, I have used ImageMagic/Wand using the image.distort method but it works for longer text, if the text is small it ...
0
votes
1
answer
673
views
Wand: drop shadow on image
I am looking for the equivalent function in wand - python of the following imagemagick code:
convert image.png \( +clone -background black -shadow 60x4+0+4 \) +swap -background none -layers merge +...
0
votes
0
answers
42
views
Supress warnings thrown by ImageMagick using Wand 0.6.10 pakage in Python 3.5.2
I have this method in Python:
from wand.image import Image
# ...some code
def convert_to_image(input_path, output_path, page_no=0):
try:
with Image(filename=input_path, resolution=200) ...
0
votes
0
answers
162
views
Why is Wand not rendering SVG to PNGs correctly on mac - ignoring Inkscape?
I have a Python Flask application on RHEL 7 that I'm using to convert SVGs to PNGs through Wand. I was running into problems with font handling, but with Inkscape installed that fixed the issue. The ...
0
votes
1
answer
105
views
distinction about txt file and pdf file
I have a django application and a upload method. And A textarea where the content of the file will be returned. So if there is a text file uploaded. Then in the textarea the content of the textfile ...
2
votes
0
answers
38
views
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 ...
0
votes
0
answers
268
views
Frame generation for video in python
I am using the Wand library to generate images. Next, I create a video from these frames. Each frame represents a set of animated objects, text, shapes, embedded images. To create a one-minute ...
0
votes
1
answer
457
views
How to install Python wand on Windows?
I installed wand with pip install wand, and the ImageMagick DLL (coming from ImageMagick-7.1.0-46-Q16-HDRI-x64-dll package) is in the PATH.
Doing this:
import wand.image
with wand.image.Image(...
0
votes
1
answer
133
views
how to use the implode effect from wand(python) from another position (not the middle of the image)?
hey I've been using this code to use the implode effect from wand on images:
with Image(filename=img_path) as img:
img.virtual_pixel = 'black'
img.implode(0.5)
img.save(filename="...
0
votes
1
answer
246
views
How can I draw a line with color and semi-transparent by wand
I use the code like blow to draw a semi-transparent black frame on my picture, border width 5 pixels.
from wand.color import Color
from wand.image import Image
from wand.display import display
from ...
2
votes
1
answer
518
views
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 ...
1
vote
2
answers
257
views
How to import two different things called the same from different modules?
I have two modules, first one is PIL, and the second one is wand, which I import from PIL and wand something called Image, and there is conflict, how do I overcome this problem?
from PIL import Image, ...
2
votes
2
answers
789
views
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 &...
1
vote
0
answers
95
views
Using a default font for captions
I'm trying to use python3-wand to recreate the following command-line invocation:
$ convert -size 4330x -density 300x300 -background transparent -gravity center -fill grey label:"This is a long ...
1
vote
1
answer
578
views
Convert SVG to PNG with custom font in Python
I have read and tried several threads, but I was unable to solve this problem.
I have a simple SVG file:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/...
0
votes
0
answers
232
views
background color of JPG using wand (Python)
I use wand with Python to change the background color of a JPEG.
with Image(file=myJpg) as image:
image.background_color = Color("#f0f0f0")
image.save(filename='myJpg.jpg')
It seems ...
0
votes
1
answer
61
views
Implode on specified position on image
I have a question regarding the implode function (https://docs.wand-py.org/en/0.6.7/guide/fx.html#implode). Is there any possibility to use the implode function for a point in the image that is not ...
1
vote
1
answer
553
views
Android: Animated gif image resize in kmagick
I am using kmagick for resizing gif images in android. It works fine for static but gives incorretc output for gif or animated webp files.
Magick.initialize().use {
val wand = ...
0
votes
1
answer
36
views
How to check via the Wand binding whether a color string is valid in ImageMagick?
In Wand, the Python binding for ImageMagick I can use color names to create a plain image. For example:
img = Image(width=100, height=50, pseudo=f'xc:yellow')
In the example the string yellow has to ...
4
votes
1
answer
4k
views
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 ...
0
votes
1
answer
623
views
python colab issue with wand library
greetings ---
hey gues , I have an a problem with google.colab when I want to run this code :
# Import Image from wand.image module
from wand.image import Image
# Read image using Image() ...
1
vote
1
answer
449
views
Do you know how to setup Wand on Mac?
I just want to be able to import Wand and use it on Python on my Mac but it doesn't seem possible anymore.
I have updated and cleanup homebrew, then run brew install imagemagick@6
Then I export ...
0
votes
1
answer
48
views
Incontinuity in straight segment of wand's polyline
I'm trying to draw some polylines with wand (v0.6.7), and I've ran across a problem that can be reproduced by running this reduced example.
from wand.image import Image
from wand.drawing import ...
0
votes
1
answer
141
views
How to convert this ImageMagick command for white background removal to Python Wand module?
I am referring to @fmw42 and his wonderful ImageMagic command to turn a white background to a transparent background. I modified his original command to work with the latest version of ImageMagick.
...
-1
votes
1
answer
125
views
Python Wand text - "€"Symbol
I'm looking for a way to display the Euro symbol (€) in a text drawing. It's currently been displayed as shown below:
Code:
from wand.drawing import Drawing as WandDrawing
from wand.image import ...
0
votes
1
answer
464
views
Converting PDF to PNG with ImageMagick & Wand via Python
I am using ImageMagick to convert a PDF into an image.. it works great when I try:
convert -density 150 -trim summary-reports/20211027 -quality 100 -flatten -sharpen 0x1.0 output/20211027.png
So as ...
0
votes
0
answers
73
views
My imagewand raises an exception on 2nd run of while loop
I am writing a script which converts PDF to Image for an OCR to read to then rename the PDF. It then deletes the converted image after the task has been executed. Since OCR is not 100% correct, I ...
0
votes
1
answer
284
views
how convert Imagemagick to Wand?
I am doing a e-ink project, the screen has 1404x1872 resolution and 16 colors grayscale. I am trying to convert Imagemagick below command to Wand:
convert image.jpg -gravity center -background black -...
0
votes
1
answer
202
views
Can you crop multiple areas from the same image with Wand?
I have two images and would like to extract multiple areas from the first image and overlay them on the second image. Is there a way to crop multiple areas from an image without loading the first ...
0
votes
1
answer
261
views
Applying wand to all images in a directory
I try to convert all the pdf of a directory into images, but I have an issues because it only convert one pdf not all of them.
import matplotlib
import pytesseract
import os
import argparse
import cv2
...
0
votes
2
answers
394
views
In Python, how do I draw/ save a monochrome 2 bit BMP with Wand
I have a need to create a 2 bit monochrome Windows BMP format image, and need to draw lines in a pattern. Since I have just started using python, I followed a tutorial and installed the Wand module.
...
0
votes
1
answer
593
views
Python/Wand/Imagemagick: Adding caption
I am trying to replicate some annotation examples. Below is my code and I am wondering what's going wrong.
from wand.font import Font
from wand.image import Image
from wand.display import display
...
0
votes
0
answers
62
views
Need help for imagemagick
You need to write a python script that takes the files ( images + logo) from a given directory,
and outputs the resulting ppt file in the same directory.
0
votes
1
answer
1k
views
Is there any way to fit an image in pptx without changing the aspect ratio of an image using python pptx package
I have a task to create water mark in images and create pptx using these images
and i should not change the aspect ratio of an image as per the rules
Image ratio = 4000x6016
Without changing the ...
1
vote
0
answers
99
views
can I use wand API in python without installing ImageMagick?
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 ...
1
vote
0
answers
131
views
Huge filesize when making gif with python Wand
I'm trying to do a gif of liquid rescales with Wand, but when the gif is saved into a file the filesize is obscene huge, I mean, from a JPG image of 1539x2048 and 242 KB it yields a gif of 55 MB. ...