imagemagick-convert

How to resize an image in imagemagick but keep an aspect ratio constant

烈酒焚心 提交于 2020-01-04 13:58:13
问题 I am trying to resize an image (using imagemagick) to keep it's current aspect ratio but fit it into a 4/3 container. This is the command I have so far: magick convert ./horse.jpeg -background white -gravity center -extent 4/3 ./hourse_output.jpeg This is what I'd like: . As you can see, the image is "put into" a 4/3 container. 回答1: My error. The aspect ratios such as 4:3 in ImageMagick -extent will only crop and not pad. See my bash unix script "aspectpad" at http://www.fmwconcepts.com

Convert images which have the same names but different extensions

一笑奈何 提交于 2020-01-04 06:56:09
问题 For example, I have two files: aaa.jpg (with cat) aaa.png (with dog) As you can see, images are different, despite of their names, which are the same. I want to convert both these images to one single format. The basic attempt for this task is mogrify -format jpg *.png But it doesn't work, for obvious reasons (one folder cannot contain multiple files with the same name and extension). Also, some notes from myself. Please note, this is just example. In real life, it would be about 100-200

ImageMagick resize - set width for both landscape and portrait images

一曲冷凌霜 提交于 2020-01-02 05:03:11
问题 I'm trying to get images resized to a given width , with the height being adjusted proportionally - no matter if the image has landscape or portrait orientation. I have two images I test the ImageMagick convert -resize command with and from what I have read, I would expect the following to work for any kind of image: convert source.jpg -resize 200 out.jpg The problem is, it doesn't. Here are my results: Source Image 1: landscape , 3264 × 2448 , resizes to 200 × 150 ==> WORKS Source Image 2:

ImageMagick change image width and height

时光毁灭记忆、已成空白 提交于 2020-01-01 17:26:13
问题 I am using ImageMagick to resize image resolution by using below command-line option convert abc.png -set units PixelsPerInch -density 75 abc_a.png I am in need of this: if any images has more than 300 width OR more than 100 height, I want to convert it to width 300 width and 100 height, with changing above dpi (i.e. 75dpi). Can any one help me on this? 回答1: If you are on Linux/OSX, you can get the image dimensions like this: identify -format "%w %h" input.jpg So, if you want the width and

Defining the file order for ImageMagick convert

£可爱£侵袭症+ 提交于 2020-01-01 02:36:08
问题 I have a bunch of PNG files named foo<bar>.png I wish to convert to TIF animation. <bar> is a number varies from 0 to 25 in leaps of five. ImageMagick place foo5.png last in the animation while it is supposed to be second. Is there a way, apart from renaming the file to foo05.png to place it in the right place? 回答1: You just give the order of your PNG files as they should appear in the animation. Use: foo0.png foo5.png foo10.png foo15.png foo20.png foo25.png instead of foo*.png After all, it

ImageMagick compare executable: unrecognized option `-metric' @ error/convert.c/ConvertImageCommand/2060

夙愿已清 提交于 2019-12-30 14:37:12
问题 I tried to use apt-get install imagemagick command to install ImageMagick on my Debian Wheezy. But when I try to diff images, I get following error: root@work:/home/tests/YAML_SHOTS/en-us# convert 1.png 2.png -metric RMSE -compare 3.png convert.im6: unrecognized option `-metric' @ error/convert.c/ConvertImageCommand/2060. Secondly, I tried to install ImageMagick from binary source (described here: http://www.imagemagick.org/script/install-source.php#unix). But it does not install the convert

Multifile favicon.ico much bigger than sum of sizes of component files

孤街浪徒 提交于 2019-12-30 10:00:10
问题 I want to create multifile favicon.ico according to great favicon cheat sheet. I created 3 .png files, optimized them with OptiPNG and received files with 1, 2 and 3kb size. Now I'm trying to create favicon.ico from them using Imagemagick but final file is around 15kb big (sum of component files is around 6kB). What causes this effect and how i can avoid it ? 回答1: A workaround is to rely on the HTTP gzip compression. For example, I packed 3 PNG pictures (3580 bytes in total) in a 15086 bytes

Generate images with ImageMagick without saving to file but still display them on website

送分小仙女□ 提交于 2019-12-30 06:56:51
问题 This is my ImageMagick code which works fine on my webserver by creating new image with the file name 'coloured_font.png' in a default directory ... <?php $cmd = " -background none -pointsize 60 -font Times-Roman -fill red ". " -strokewidth 1 -stroke black label:\"google\" "; exec("convert $cmd coloured_font.png"); ?> But now I am running ImageMagick on Windows which will not create any image files in a default folder but ImageMagick applications runs fine(i have tested by creating thumbnail)

Python subprocess: wait for command to finish before starting next one?

僤鯓⒐⒋嵵緔 提交于 2019-12-30 06:20:11
问题 I've written a Python script that downloads and converts many images, using wget and then ImageMagick via chained subprocess calls: for img in images: convert_str = 'wget -O ./img/merchant/download.jpg %s; ' % img['url'] convert_str += 'convert ./img/merchant/download.jpg -resize 110x110 ' convert_str += ' -background white -gravity center -extent 110x110' convert_str += ' ./img/thumbnails/%s.jpg' % img['id'] subprocess.call(convert_str, shell=True) If I run the content of convert_str

ImageMagick Command-Line Option Order (and Categories of Command-Line Parameters)

那年仲夏 提交于 2019-12-28 03:04:27
问题 My supervisor has asked me to convert the parts of our Perl scripts that use PerlMagick to instead pipe and use the command line version of ImageMagick (for various unrelated reasons). Using the our existing interface (crop, scale, save, etc) I'm building up a list of operations the user wants to perform on an image, constructing the statement to pipe and then executing it. What I would like to know is: Are convert operations performed from left to right? ie the order I pass them What happens