ImageMagick

ImageMagick PDF to JPGs sometimes results in black background

泄露秘密 提交于 2019-12-20 09:48:26
问题 I have the following: ghostscript-fonts-5.50-24 ImageMagick-6.7.2-1 ghostscript-9.02-1 Which I use to create a series of JPGs for each page using: convert -density 175 -colorspace sRGB test.pdf -resize 50% -quality 95 test.jpg When I run this on my windows machine all appears to work ok, but on our linux server we get the black background problem. The resulting JPGs have a black background rendering the image un-readable, what am I missing or is there something I should be doing to correct

Removing the background noise of a captcha image by replicating the chopping filter of TesserCap

不想你离开。 提交于 2019-12-20 09:24:24
问题 I have a captcha image that looks like this: Using a utility called TesserCap from McAfee, I could apply a "chopping" filter to the image. (Before running it, I made sure there were only two colors in the image, white and black.) I was very impressed with the results of using that filter with a value of 2 in the text box. It accurately removed most of the noise but kept the main text, resulting in this: I wanted to implement something like this on one of my own scripts, so I tried to find out

Resize existing images to new style in paperclip & RMagick

我与影子孤独终老i 提交于 2019-12-20 08:01:46
问题 I've been using paperclip to upload and auto-resize photos in my Rails app, and I love it. Only problem is about every other month my crazy manager decides he wants a new size to display the photos in. So I add a new style in my Photo model and all is good for new photos, but the pre-existing photos are now a problem. Now that I'm starting to have more than a few photos to deal with I need a programmatic way to resize existing photos. Perhaps there is some paperclip trick for such a thing? I

ImageMagick or GD Library for image resizing and thumbnail creation?

瘦欲@ 提交于 2019-12-20 07:39:13
问题 I had been using the image resize class written by someone else to resize images or to create the thumbnails, here is the link to the class I had been using. http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php I guess image GD library has some limitations for the resolution or the file size of images, it works fine for low resolution picture resizing(below 1024px) but it does not resize if I try to upload the high resolution jpeg image (i.e 3400px X 2200px) roughly, The

Can't load PDF with Wand/ImageMagick in Google Cloud Function

谁说胖子不能爱 提交于 2019-12-20 06:31:11
问题 Trying to load a PDF from the local file system and getting a "not authorized" error. "File "/env/local/lib/python3.7/site-packages/wand/image.py", line 4896, in read self.raise_exception() File "/env/local/lib/python3.7/site-packages/wand/resource.py", line 222, in raise_exception raise e wand.exceptions.PolicyError: not authorized `/tmp/tmp_iq12nws' @ error/constitute.c/ReadImage/412 The PDF file is successfully saved to the local 'server' from GCS but won't be loaded by Wand. Loading

Quickly get brightness / luminosity of images

时光总嘲笑我的痴心妄想 提交于 2019-12-20 05:28:08
问题 I'm working in php, and going through each image pixel-by-pixel to get an average brightness for each image is going to be way to cpu intensive... I've looked through both GD and imagemagick docs, but haven't found a way to return the average brightness of an image... Can this be done quickly either in these libraries, or in another package easily accessible by php? 回答1: Here is an interesting post using ImageMagick for computing the average graylevel of an image. This post also discusses

GetPixel after SetPixel gives incorrect result

青春壹個敷衍的年華 提交于 2019-12-20 04:50:47
问题 I set pixel from one jpg. Save it another jpg file. Read a new file again. Get pixel. But it gives me incorrect result. That's my code: use Image::Magick; use Data::Dumper; my $im = new Image::Magick; $im->Read('file1.jpg'); my @pixel = $im->GetPixel(x=>0,y=>0,channel=>'RGB', normalize=>'True'); print Dumper(@pixel); my @color = ('1.0', '0.0', '0.0'); $im->SetPixel(x=>0, y=>0, channel=>'RGB', normalize=>'True', color => \@color); $im->Write('file30.jpg'); @pixel = $im->GetPixel(x=>0,y=>0

ImageMagick with VS2012

余生长醉 提交于 2019-12-20 04:19:59
问题 First thanks a lot for reading my thread. I am trying to use ImageMagick with VS2012 on Windows 7 64-bit for image rotation. Here is what I did: Download ImageMagick for windows, and unzip it. Go to \ImageMagick-6.8.8\VisualMagick\configure\ folder, open configure.dsw in VS2012, and build it. It was successful. open configure.exe in \ImageMagick-6.8.8\VisualMagick\configure\, and click "next" -> "finish" with default settings. After step 3, an VisualDynamicMT.sln is generated in \ImageMagick

A way to perform the +level ImageMagick operation in Wand?

十年热恋 提交于 2019-12-20 04:11:05
问题 Using the +level ImageMagick operator (https://imagemagick.org/script/command-line-options.php#level) in command line will produce an output image with the channel values of the input image compressed to the range specified. For example, the following ImageMagick command will cause the output pixel intensity values to be present between 45% and 70% of the total pixel value range. magick input.jpg +level 45%,70% output.jpg How do you perform the +level ImageMagick operation in Wand? The wand

Replace only background color of PNG

别说谁变了你拦得住时间么 提交于 2019-12-20 03:13:45
问题 Here is my code: #! /usr/bin/env sh # Generate test image. convert -size 100x60 xc:blue -fill blue -stroke black -draw "circle 50,30 55,55" in.png # Make background transparent. convert in.png -fill none -draw 'matte 0,0 floodfill' -flop -draw 'matte 0,0 floodfill' -flop out.png # Replace transparent background with green. mogrify -background green -flatten out.png # The wrong way. convert in.png -transparent blue oops.png mogrify -background green -flatten oops.png It is based on this