imagemagick-convert

converting DURING upload before saving on server png/gif to jpg

北慕城南 提交于 2019-12-01 11:05:56
So I have an image upload script. It uploads the image and saves it to the space on the server. What I can't seem to get my head around is say, when the user uploads a .png, by the time it saves on my server i want it to be a jpg. Can anyone help with this, and please don't just direct me to another question as I havent had anything work yet. Here is an example of my code. $name = addslashes($_FILES['image']['name']); $ext = pathinfo($_FILES['image']['name'], PATHINFO_EXTENSION); $size = $_FILES['image']['size']; $temp = $_FILES ['image']['tmp_name']; $error = $_FILES ['image']['error']; if (

ImageMagick - calculate perspective without knowing image dimensions

蓝咒 提交于 2019-12-01 10:16:20
问题 How can I get the maximum width and height of an image, perform some maths on it, then use it in my perspective distortion? I have a bunch of images to which I want to apply a perspective distortion. The only problem is, each image is a different size. This code works on an image where I know the size (1440 * 900). convert test.jpg -matte \ -virtual-pixel transparent \ -distort Perspective '0,0 75,0 \ 0,900 0,450 \ 1440,0 1440,200 \ 1440,900 1200,900' \ distorted.jpg I know I can get the

ImageMagick trimming to a border

ⅰ亾dé卋堺 提交于 2019-12-01 10:04:32
问题 I'm using ImageMagick to trim margins off of a scanned page. The page has a black border and for our purposes looks something like this: These are scans though, so there's often dust and other gunk making things less pretty. The command I'm using for the trimming is: convert <filename> -crop \ `convert <filename> -virtual-pixel edge -blur 0x15 -fuzz 40% -trim \ -format '%wx%h%O' info:` +repage <filename> This is mostly copied from various forums (I don't know what -format does, for instance).

converting DURING upload before saving on server png/gif to jpg

烈酒焚心 提交于 2019-12-01 07:51:44
问题 So I have an image upload script. It uploads the image and saves it to the space on the server. What I can't seem to get my head around is say, when the user uploads a .png, by the time it saves on my server i want it to be a jpg. Can anyone help with this, and please don't just direct me to another question as I havent had anything work yet. Here is an example of my code. $name = addslashes($_FILES['image']['name']); $ext = pathinfo($_FILES['image']['name'], PATHINFO_EXTENSION); $size = $

How to use stdin with caption in ImageMagick

送分小仙女□ 提交于 2019-12-01 05:47:22
问题 My understanding from reading the ImageMagick documentation regarding text, is that the @- notation reads the contents of standard input. As such, this should be a fairly straight forward way to render Hello World. printf "Hello\nWorld" | convert \ -size 1280x100 \ -background '#0000FF10' \ -density 90 \ -gravity Center \ -fill black \ -font Helvetica \ caption:@- \ test.png On OS X 10.11.5 via HomeBrew, this works, using convert Version: ImageMagick 6.9.4-3 Q16 x86_64 2016-05-20. However on

running imagemagick convert (console application) from python

﹥>﹥吖頭↗ 提交于 2019-12-01 01:35:38
I am trying to rasterize some fonts using imagemagick with this command which works fine from a terminal: convert -size 30x40 xc:white -fill white -fill black -font "fonts\Helvetica Regular.ttf" -pointsize 40 -gravity South -draw "text 0,0 'O'" draw_text.gif Running the same command using subprocess to automate it does not work: try: cmd= ['convert','-size','30x40','xc:white','-fill','white','-fill','black','-font','fonts\Helvetica Regular.ttf','-pointsize','40','-gravity','South','-draw',"text 0,0 'O'",'draw_text.gif'] #print(cmd) subprocess.check_output(cmd,shell=True,stderr=subprocess

Use two different fonts in imagemagick on one line

眉间皱痕 提交于 2019-12-01 01:08:19
So i want to draw on my image text lets say in this example "Trevor, 24" But I want to use the font Helvetica for Trevor, and for 24 i want to use the font Arial. But I want it to be on the same line and look like it's one. Is it possible or how would i go about making it so that even if i change the name and age, that i can print it out like this? "Trevor, (Helvetica) 24(Ariel)" I would assume to print them next to eachother, but if someone enters the name longer than Trevor 24 would go over it. the idea is to make it on the same line What do you guys think? $draw = new ImagickDraw(); $color

Fastest way to create multiple thumbnails from a single large image in Python

梦想与她 提交于 2019-12-01 00:21:04
I have a library of large images (8000x6000px ~13mb) for which I would like to generate multiple thumbnails of smaller sizes with widths of 3000px, 2000px, 1000px, 500px, 250px, and 100px. The source image is stored in a flat file, and the generated thumbnails will also be stored in flat files. I've been thinking about the optimal way to do this in Python, and these are potential issues that immediately come to mind: Would it make sense to generate each thumbnail from source image, or can I create the smaller thumbnails from any thumbnail that is slightly larger? E.g., 8000px -> 3000px, 3000px

ImageMagick: Lossless max compression for PNG?

淺唱寂寞╮ 提交于 2019-11-30 10:56:45
问题 I'd like to achieve a maximum amount of compression when saving to a lossless PNG using ImageMagick. I'm doing batch conversion of many PSDs. I tried a few things, but it looks to me like the resulting PNG image is not as sharp as original image, although my wife cannot see it. These are current arguments I'm playing with: convert -depth 24 -define png:compression-filter=1 \ -define png:compression-level=9 -define png:compression-strategy=2 According to: http://www.imagemagick.org/script

ImageMagick - Making 2 GIFs into side by side GIFs using IM convert

扶醉桌前 提交于 2019-11-30 09:53:00
I have 2 GIFs that are the same length. I want to put the GIFs beside each other to have 1 GIF with both playing at the same time. I have tried to use the convert tool with: convert +append 1.gif1 2.gif output.gif However, this seems to blend all the images together and changes the size to be extremely small. I was thinking that I could append each image together and then create a GIF out of those already combined images. However it did not work when I tried: convert -delay 15 -loop 0 1*.png 2*.png +append output.gif I have a lot of images with long names and I do not want to have to go