Page 1 of 1

Struggeling with running a big query

Posted: 2008-07-04T09:02:14-07:00
by forumim
Hy

I am confused with a long Query:

Code: Select all

convert original.jpg
-resize 1024x683 resized_original.jpg 
-size 1024x768 xc:#e3d4ef background_color.jpg -gravity northwest 
-composite original_on_background.jpg 
-crop 256x256 -quality 60 original_on_background.jpg  mytiles%02d.jpg
I would like:
Resize the original image:

Code: Select all

convert -resize 1024x683 resized_original.jpg 
Creating a background-image in a different size

Code: Select all

convert -size 1024x768 xc:#e3d4ef background_color.jpg
Putting the background-image and the resized-image together

Code: Select all

convert -gravity northwest -composite original_on_background.jpg 
Cutting tiles from the final image (original_on_background.jpg)

Code: Select all

convert -crop 256x256 -quality 60 original_on_background.jpg  mytiles%02d.jpg
Every sigle qery works great.
But when I put together the 4 queries it doesent work.
The original_on_background.jpg ist not what it sholud be. I don't understad what happend exactly.

Mabe it is not possible to work with such big queries.
Mabe i need to run each query in a single way.

(I run the query in PHP: exec(my-query). I think, it is better to run one query than four. Isn't it?)

Aperciate any help, I would like to understand....
Schorsch

Re: Struggeling with running a big query

Posted: 2008-07-04T09:29:51-07:00
by el_supremo
Try this:

Code: Select all

convert -size 1024x768 xc:#e3d4ef ( original.jpg -resize 1024x683 ) -gravity northwest \
   -composite -crop 256x256 -quality 60 mytiles%02d.jpg
Pete

Re: Struggeling with running a big query

Posted: 2008-07-04T11:44:34-07:00
by Bonzo
Slightly different method mentioned by Anthony

Code: Select all

<?php
exec("convert ( input.jpg -resize 1024x683 ) -background #e3d4ef -extent 1024x768 -crop 256x256 -quality 60 mytiles%02d.jpg");
?>

Re: Struggeling with running a big query

Posted: 2008-07-05T05:34:01-07:00
by forumim
This works:

Code: Select all

exec("convert input.jpg -resize 1024x683 output.jpg", $arr, $err);
This doesn't work:

Code: Select all

exec("convert (input.jpg -resize 1024x683) output.jpg", $arr, $err);
Error: 2
Version: ImageMagick 6.2.8 04/17/08 Q16

Any idea, why (...) -stuff doesen't work?

Schorsch

Re: Struggeling with running a big query

Posted: 2008-07-05T05:59:48-07:00
by Bonzo
Couple of things to try

Note spaces

Code: Select all

( input.jpg -resize 1024x683 )
Escape the ( )

Code: Select all

/(input.jpg -resize 1024x683/)

Re: Struggeling with running a big query

Posted: 2008-07-05T07:20:48-07:00
by forumim
Thanks! Problem solved:

Code: Select all

exec("convert \( image.jpg -resize 1024x683 \) -background red -extent 1024x768 -crop 256x256 -quality 60 mytiles%02d.jpg", $arr, $err );
but

Code: Select all

-background red 
doesen't work.
It is always black. Dosen't matter, which color I define.

Other Question:

Code: Select all

mytiles%02d.jpg
Can I save the tile-images, so that the images on the first line are named:
mytiles1-00.jpg, mytiles1-01.jpg, mytiles1-02.jpg...

And the tiles on the second line:
mytiles2-00.jpg, mytiles2-01.jpg, mytiles2-02.jpg...

And so on...