how i can do this in Imagemagick command line?
how i can do this in Imagemagick command line?
Hello
I want do this in Imagemagick command line, but I'm not get...
$img_r = imagecreatefromjpeg($capa);
$dst_r = ImageCreateTrueColor($targ_w, $targ_h);
imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],$targ_w,$targ_h,$_POST['w'],$_POST['h']);
imagejpeg($dst_r, $capa);
Thank you for help.
I want do this in Imagemagick command line, but I'm not get...
$img_r = imagecreatefromjpeg($capa);
$dst_r = ImageCreateTrueColor($targ_w, $targ_h);
imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],$targ_w,$targ_h,$_POST['w'],$_POST['h']);
imagejpeg($dst_r, $capa);
Thank you for help.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: how i can do this in Imagemagick command line?
From the desription of imagecopyresampled at http://php.net/manual/en/function.image ... ampled.php , this function is equivalent to a "-crop" and "+repage", followed by "-resize", followed by "-compose Over -composite" with a "-geometry" setting.
snibgo's IM pages: im.snibgo.com
Re: how i can do this in Imagemagick command line?
Sure, but I'm not able to get there.
You can help me? I can send a donation via paypal if you help me.

You can help me? I can send a donation via paypal if you help me.

Re: how i can do this in Imagemagick command line?
I can not test this at the moment but try:
You may need to use \( and \) instead of ( and )
You can more options once this is working if required.
You WILL need to use \( and \) instead of ( and ) if on a Linux type machine Windows just uses ( and )
Code: Select all
convert background.jpg ( input.jpg -crop 500x500+10+10 ) -gravity center -composite output.jpg
You can more options once this is working if required.
Is this using php?Imagemagick command line
Code: Select all
exec("convert background.jpg ( input.jpg -crop 500x500+10+10 ) -gravity center -composite output.jpg");
Re: how i can do this in Imagemagick command line?
Thanks, but I still can't get what I want.
Please check the image: http://oi60.tinypic.com/5xk0n7.jpg
I have this jquery script, and I want crop the image using imagemagick.
I can do this with PHP GD using this code:
But I have difficulty to get the exact command to get this.
Thank you for helping!
Please check the image: http://oi60.tinypic.com/5xk0n7.jpg
I have this jquery script, and I want crop the image using imagemagick.
I can do this with PHP GD using this code:
Code: Select all
$targ_w = 404;
$targ_h = 316;
$file = 'image.jpg';
$img_r = imagecreatefromjpeg($file);
$dst_r = ImageCreateTrueColor($targ_w, $targ_h);
imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],$targ_w,$targ_h,$_POST['w'],$_POST['h']);
imagejpeg($dst_r, $file);
Thank you for helping!
Re: how i can do this in Imagemagick command line?
If you only want a crop:
Code: Select all
exec("convert input.jpg -crop 200x200+10+10 output.jpg");
Re: how i can do this in Imagemagick command line?
I want resize and crop...
Re: how i can do this in Imagemagick command line?
Code: Select all
exec("convert input.jpg -resize 300x300 -crop 200x200+10+10 output.jpg");
Re: how i can do this in Imagemagick command line?
Thanks for helping, but it not working:
I want get the first image: http://oi60.tinypic.com/5xk0n7.jpg
Code: Select all
Array
(
[x] => 94
[y] => 16
[w] => 409.1139240506329
[h] => 320
)
exec("convert input.jpg-resize '202x158!' -crop {$_POST['w']}x{$_POST['h']}+{$_POST['x']}+{$_POST['y']} output.jpg");
Re: how i can do this in Imagemagick command line?
Give this a try:
In your code you need a space before -resize and your dimensions are incorrect as your resize is smaller than your crop.
First convert is resizing the original photo then cropping it with an x, y offset. It is then putting it on a 500 square white background.
The second convert is creating an image with a white background, adding the text and joining the two images.
I do not know if the text will be as good a quality as you will want.
Code: Select all
convert input.jpg -resize 500x500 -crop 409x320+14+16 +repage -gravity center -background white -extent 500x500 -flatten temp.png
convert temp.png ( -size 500x100 xc:white -fill blue -pointsize 16 -gravity northwest -annotate +20+0 "Test" -fill black -pointsize 14 -gravity northwest -annotate +20+40 "Test" ) -append output.jpg
First convert is resizing the original photo then cropping it with an x, y offset. It is then putting it on a 500 square white background.
The second convert is creating an image with a white background, adding the text and joining the two images.
I do not know if the text will be as good a quality as you will want.
Re: how i can do this in Imagemagick command line?
Thanks for helping, but it not working...
Objectively, how I can get do this with Imagemagick?
ImageCreateTrueColor equal convert input.jpg -resize 500x500 output.jpg ?
imagecopyresampled equal convert input.jpg -crop {$_POST['w']}x{$_POST['h']}+{$_POST['x']}+{$_POST['y']} output.jpg
?
Objectively, how I can get do this with Imagemagick?
Code: Select all
$dst_r = ImageCreateTrueColor($targ_w, $targ_h);
imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],$targ_w,$targ_h,$_POST['w'],$_POST['h']);
imagecopyresampled equal convert input.jpg -crop {$_POST['w']}x{$_POST['h']}+{$_POST['x']}+{$_POST['y']} output.jpg
?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how i can do this in Imagemagick command line?
Perhaps you should provide an example input and output with your exact command using actual numbers and not arguments. That way some one can actually run a test comparison.
You can upload to any free hosting service such as dropbox.com and put the URLs here.
You can upload to any free hosting service such as dropbox.com and put the URLs here.
Re: how i can do this in Imagemagick command line?
Code: Select all
$dst_r = ImageCreateTrueColor(404, 316);
imagecopyresampled($dst_r, $img_r, 0, 0, 297, 0, 404, 316, 253, 197);
convert input.jpg -resize 404x316 output.jpg
convert input.jpg -crop 253x197+297+0 output.jpg
http://oi61.tinypic.com/fjnr6d.jpg - result of imagemagick
It's not working, and I don't know how i can convert PHP GD code to Imagemagick command line...
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how i can do this in Imagemagick command line?
Where is the input image?
Just a guess without seeing the input but perhaps
Just a guess without seeing the input but perhaps
Code: Select all
convert input.jpg -resize 404x316 -crop 253x197+297+0 output.jpg