21
votes
6answers
1k views

How to set the background color when rendering a PNG using PythonMagick

I'm trying to render an SVG->PNG using PythonMagick, but it seems that the background color is ignored. Using the ImageMagick command, things work as expected: tmp$ convert -background none ...
18
votes
4answers
9k views

Converting a PDF to a series of images with Python

I'm attempting to use Python to convert a multi-page PDF into a series of JPEGs. I can split the PDF up into individual pages easily enough with available tools, but I haven't been able to find ...
14
votes
5answers
932 views

How to unit test a Python function that draws PDF graphics?

I'm writing a CAD application that outputs PDF files using the Cairo graphics library. A lot of the unit testing does not require actually generating the PDF files, such as computing the expected ...
12
votes
4answers
11k views

Documents and examples of PythonMagick

Where can I find the document and examples of PythonMagick? I did a search on Google but no much information was found.
9
votes
1answer
1k views

Trim whitespace using PIL

Is there a simple solution to trim whitespace on the image in PIL? ImageMagick has easy support for it in following way: convert test.jpeg -fuzz 7% -trim test_trimmed.jpeg I found a solution for ...
8
votes
1answer
4k views

Can I access ImageMagick API with Python?

I need to use ImageMagick as PIL does not have the amount of image functionality available that I am looking for. However, I am wanting to use Python. The python bindings (PythonMagick) have not been ...
7
votes
1answer
206 views

Histogram of an Image's “Black Ink Level” by Horizontal Axis

I have a black and white image (or pdf) file, and want to get a histogram of the image's horizontal profile. That is, for each column in the image I want the sum of the grayscale values of the pixels ...
7
votes
4answers
4k views

Use ImageMagick with python. (on a linux system)

I want to define a function that "call" imagemagick to convert an image. def convert(filein,fileout): #imagemagick>convert filein fileout How can I call and use imagemagick with python? I'm ...
6
votes
1answer
752 views

How to display an animated gif with imagemagick and python?

I want to open a GIF image from the python console. Normally when opening .png or .jpg, I would do the following: >>> from PIL import Image ...
5
votes
1answer
1k views

Resize GIF animation, pil/imagemagick, python

I want to change size of GIF animation image using python and PIL or PythonMagick. I can't find solution. PIL and thumbnail method works for jpg and png but not for gif. ImageMagick has command ...
5
votes
1answer
309 views

How do I fit an image to a fixed size box using pythonMagick in python

try: original = PythonMagick.Blob(data) image = PythonMagick.Image(original) except Exception as e: raise errors.UnknownFileFormat() medium = PythonMagick.Blob() small = ...
4
votes
2answers
766 views

How can I grab the color of a pixel on my desktop? (Linux)

I want to grab the color of a pixel with known coordinates on my Linux desktop. Until now, I've used "import -window SomeWindow -crop 1x1+X+Y /tmp/grab.jpg" then extracting the pixel value using ...
3
votes
4answers
146 views

Find all images that have square dimensions (1:1 ratio) [closed]

Is it possible to use any *nix programs like 'find' or a scripting language like Python, PHP or Ruby, that can search your HDD and find all images that have the same width and height, aka square ...
3
votes
1answer
1k views

Python binding to ImageMagick

I am looking for a good Python binding to ImageMagick, but there seem a lot of bindings already. I am not sure that which of these is the right tool for my job. Can you guys recommend me one? Here is ...
3
votes
3answers
1k views

ImageFont's getsize() does not get correct text size?

I use the following two methods to to generate text preview image for a .ttf font file PIL method: def make_preview(text, fontfile, imagefile, fontsize=30): try: font = ...

1 2 3 4 5 6
15 30 50 per page