ImageMagick

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

≯℡__Kan透↙ 提交于 2019-12-18 05:04:35
问题 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') img.format = 'tif' img.alpha_channel = False How can i convert img object to open cv (cv2) image object in python? 回答1: You would simply write to a byte-array buffer, and pass to cv2.imdecode . from wand.image import Image as WandImage from wand.color import

ImageMagick convert SVG to PNG not working with RSVG enabled

爱⌒轻易说出口 提交于 2019-12-18 04:47:07
问题 I'm using ImageMagick's convert utility to convert SVG file to PNG image. At first, I used vanilla installation of IM on OSX ( brew install imagemagick ) to convert the SVG using: $ convert file.svg file.png This worked except that some of the image objects in that file were offset (actual links to images). I then read a related question that suggested ImageMagick to be compiled with rsvg support (homebrew does it with brew install imagemagick --use-rsvg ). Now, when I try to perform the

How can I upload an image from a URL in PHP

青春壹個敷衍的年華 提交于 2019-12-18 03:01:31
问题 In PHP using GD or imagemagick how can I uplaod a photo from a URL, I want to build a function that I can pass in a few parameters and uplaod the image, I can currentyl uplaod a big image, resize it smaller, then resize some more thumbnails off it and save all into there locations from 1 image but I would like to add the ability to get an image from a URL and then run my code on it to resize and make thumbs. Would I use curl or something else any example or ideas would be greatly appreciated

Convert PDF to PNG using ImageMagick

纵然是瞬间 提交于 2019-12-17 22:04:40
问题 using ImageMagick, what command should i use to convert a PDF to PNG? I need highest quality, smallest file size. this is what I have so far (very slow by the way): convert -density 300 -depth 8 -quality 85 a.pdf a.png Looking at what Gmail does when a user "view" a PDF, the quality is awesome and the file size very minimal. The DPI is just 96 (I have to set a density of 300 to get anything decent). Anyone know how GMail does it? Thanks. 回答1: when you set the density to 96, doesn't it look

Watermark on animated gif with php

浪尽此生 提交于 2019-12-17 19:48:18
问题 I need a function that adds a watermark to an animated gif. How I can do that with PHP and ImageMagick? This is my code, but it doesn't work. function IMagickWatermark($sf, $sfDest, $sfLogo, $sGravity='southeast'){ //$sCmd = "composite -compose bumpmap -gravity $sGravity $sfLogo \"$sf\" $sfDest"; $sCmd = "convert \"$sf\" -coalesce -gravity south -draw 'image over 0,0 0,0 \"$sfLogo\"' \"$sfDest\""; exec($sCmd); return 1; } $sf = $_SERVER['DOCUMENT_ROOT']."/test/source.gif"; $sfDest = $_SERVER[

Imagemagick issue on Lion installed with Homebrew

三世轮回 提交于 2019-12-17 16:48:09
问题 I am trying to use the Paperclip gem on a Rails project so followed the docs and first installed Imagemagick using the Homebrew recipe. I added to my model my attachment has_attached_file :screenshot This worked OK and the file uploads functioned as expected I then wanted to add thumbnails to this, so again followed the docs and added to the model has_attached_file :screenshot, :styles => { :medium => "300x300>", :thumb => "100x100>" } At this point the uploads no longer worked I check the

Using the C API for ImageMagick (on iPhone?) to convert to monochrome?

為{幸葍}努か 提交于 2019-12-17 15:52:12
问题 I am using the code referenced in this post, but would like to switch to an ImageMagick C-API based solution, as I want to standardize on a single image manipulation library, and need IM for some other tasks. I can find tons of examples of using the convert command line tool, but none on how to do the monochrome conversion in code. Any sample code out there? 回答1: You can achieve monochrome conversion, as described here, with MagickQuantizeImage function. I'm not quite familiar with dithering

Installing ImageMagick extension with php/windows

孤者浪人 提交于 2019-12-17 15:44:51
问题 Running PHP Version 5.2.5 on Windows Server 2003 with IIS. Have virtually an identical server where we were able to install ImageMagick with no issues. It's running exactly the same version of php. Used the following steps to install, but it just won't seem to work on this server. ImageMagick itself is installed but php won't load the extension. We've spent hours trying to get the extension installed. It just won't show up in phpinfo(). INSTALL STEPS TAKEN To install IMagick on Windows XP

How to create a layered PSD file from command line?

给你一囗甜甜゛ 提交于 2019-12-17 15:25:48
问题 I need to create a layered PSD file with ImageMagick or any other command-line tool available on Linux platform. Since I need to do this on Linux server, I can't use Photoshop scripting. The ImageMagick command below creates PSD file with a single layer, where two images (here: plasma fractals) are positioned one below another. (I use ImageMagick 6.5.3-10 2009-07-31 Q16, latest available in MacPorts.) convert -size 100x100 plasma:fractal plasma:fractal -append out.psd How do I create a PSD

How to remove horizontal and vertical lines from an image

夙愿已清 提交于 2019-12-17 10:56:22
问题 I have an image that is of a text written on a spiral notebook paper. the paper has horizontal lines. I would like to remove the horizontal lines from the image. While googling I found a solution that I thought would work: Extract horizontal and vertical lines by using morphological operations The solution was in C++ so I converted it to Python. It works well on the sample image provided in that solution however, it does not seem to work for my images. While running it on my image I get these