ImageMagick

Detect if image is grayscale or color using Imagick

a 夏天 提交于 2020-01-13 02:46:09
问题 I'm attempting to try and assign a value to an image based on its 'saturation level', to see if the image is black and white or color. I'm using Imagick, and have found what seems to be the perfect code for the command line and am trying to replicate it using the PHP library. I think I understand the concept: Convert image to HSL. Extract the 'g' channel (which is the S channel in HSL). Calculate the mean of this channel. Command line code convert '$image_path' -colorspace HSL -channel g

Conditional image resizing with Carrierwave

强颜欢笑 提交于 2020-01-13 01:48:30
问题 I need to create different versions of uploaded image conditionally. I know Carrierwave supports this feature. But my requirements are a bit tricky. For each uploaded image I need to create 2 versions and need to scale the original image based on conditions. Below code will give you better idea what I am trying to do: version :leftright, :if => :image? do process :resize_to_fill => [667*2, 778*2] ,:if => :is_retina_resolution? process :resize_to_fill => [667, 778] ,:if => !:is_retina

sh: identify: command not found imagemagick rails 3

大憨熊 提交于 2020-01-13 01:42:43
问题 I am using ImageMagick-6.7.4 with rails 3 and also installed the paperclip gem to my application. I followed this guide to install imagemagick and it works from my terminal but not with my rails app. I have included the path for the identify command in my development.rb as Paperclip.options[:command_path]='/path-where-my-identify-got-installed/' but it still gives me an error as Command :: identify -format %wx%h'/var/folders/Cd/CdjXsnlyEPyFqs4pwH83T++++TI/-Tmp-/stream20120104-2402-5iizym-0

JavaScript library similar to Imagemagick (i.e., resize images and pictures while maximizing picture fidelity)?

蓝咒 提交于 2020-01-12 14:02:39
问题 We would like to simulate Imagemagick functionality, but only in Javascript. Do any libraries exist? Specifically, the goal is to display thumbnails of images without distorting the thumbnail to the point where it is hardly resembles the original. This often happens with simple resizing via CSS. One approach is to resize images on the server with Imagemagick. The question is, if we don't want to store the thumbnails (because the originals are loaded from a third party which doesn't supply

Can ImageMagick return the image size?

北城余情 提交于 2020-01-11 17:16:30
问题 I'm using ImageMagick from the command line to resize images: convert -size 320x240 image.jpg However, I don't know how to determine the size of the final image. Since this is a proportional image scale, it's very possible that new image is 100x240 or 320x90 in size (not 320x240). Can I call the 'convert' command to resize the image and return the new image dimensions? For example, pseudo code: convert -size 320x240 -return_new_image_dimension image.jpg // returns the new resized image

Batch resize images and output images to new folder with ImageMagick

☆樱花仙子☆ 提交于 2020-01-11 15:51:11
问题 Current image folder path: public_html/images/thumbs Output image folder path: public_html/images/new-thumbs I have 10 video thumbs per video in current folder, named of image thumbs: 1-1.jpg 1-2.jpg 1-3.jpg 1-4.jpg 1-5.jpg (Resize) 1-6.jpg 1-7.jpg 1-8.jpg 1-9.jpg 1-10.jpg 2-1.jpg 2-2.jpg 2-3.jpg 2-4.jpg 2-5.jpg (Resize) 2-6.jpg 2-7.jpg 2-8.jpg 2-9.jpg 2-10.jpg I want to resize all 5th images(*-5.jpg) to the new folder. I've tried below command but no luck: mogrify -path public_html/images

How to extract frames from a GIF file preserving frame dimensions

∥☆過路亽.° 提交于 2020-01-11 15:04:41
问题 I have the following GIF image file: I want to extract its frames (using PGM output format) using this imagemagick command: convert brocoli.gif out%05d.pgm But each frame has a different size. How can I extract its frames while preserving the original gif file size? 回答1: Use the -coalesce option: convert -coalesce brocoli.gif out%05d.pgm 来源: https://stackoverflow.com/questions/12791505/how-to-extract-frames-from-a-gif-file-preserving-frame-dimensions

Compiling ImageMagick as 64bit under OS X?

微笑、不失礼 提交于 2020-01-11 14:02:09
问题 I'm trying to install moddims on OS X (see previous question), an Apache module with a dependency on ImageMagick. As far as I can tell, the OS X Apache is compiled as 64 bit. My previous attempt to run the moddims module I had compiled gave the following error: httpd: Syntax error on line 117 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/libmod_dims.so into server: dlopen(/usr/libexec/apache2/libmod_dims.so, 10): no suitable image found. Did find:\n\t/usr/libexec

Error saving gif video with R animation library and Imagemagick

烂漫一生 提交于 2020-01-11 08:56:16
问题 I am trying to create a simple .gif video using Windows 7. I installed ImageMagick and it seems to be working by itself. Here is the following code I tried to run and the corresponding error message. When I run the code the ImageMagik program opens up and it looks like the data for the first run is plotted (see image below). I suspect the problem is differences between windows and Unix commands? Perhaps I need to add more to the ani.options? Any help or suggestions would be greatly

Converting SVG with custom fonts to PNG using ImageMagick

北城以北 提交于 2020-01-11 03:20:31
问题 I'm converting SVG's to PNG using ImageMagick and all works like a charm until I tried adding custom fonts using @font-face and then in the SVG file. In Batik this worked fine but now in ImageMagick I just cant get it to work. I can change the fonts to the ones listed in "convert -list font" but I will probably have to change fonts often so I want to point to the font-file on convert somehow instead using font-face or other solution doesnt matter. The SVG files can also contain multiple font