Page 1 of 1

How to get rid of the errors?

Posted: 2016-01-01T11:22:02-07:00
by excel

Code: Select all

convert -resize 200x400 i1.png -write mpr:final_1 +delete -respect-parentheses \
\( convert -resize 200x61 i2.png -write mpr:mem_1 +delete -respect-parentheses \) \
\( convert -resize 206x101 i3.png -write mpr:mem_2 +delete -respect-parentheses \) \
\( mpr:final_1 mpr:mem_1 -geometry +0+339 -composite +write mpr:final_2 \) \
\( mpr:final_2 mpr:mem_2 -geometry -3+30 -composite +write result1.png \)

convert: unable to open image `convert': No such file or directory @ error/blob.c/OpenBlob/2701.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501.
convert: unable to open image `convert': No such file or directory @ error/blob.c/OpenBlob/2701.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501.
convert: unbalanced parenthesis `)' @ error/convert.c/ConvertImageCommand/3236.

All files available but there are errors. Why?

Re: How to get rid of the errors?

Posted: 2016-01-01T11:40:24-07:00
by fmw42
1) -respect-parentheses should be placed once right after the convert and before your input image

2) You cannot have "convert" inside parentheses.

3) You need to use -clone or mpr inside parentheses. See
http://www.imagemagick.org/Usage/basics/#parenthesis
http://www.imagemagick.org/Usage/basics/#clone
http://www.imagemagick.org/Usage/basics/#complex
http://www.imagemagick.org/Usage/files/#mpr
http://www.imagemagick.org/Usage/files/#write

4) If that does not help, if you can explain what you are trying to do, perhaps we can help correct your command line.

Re: How to get rid of the errors?

Posted: 2016-01-01T13:29:21-07:00
by excel
Hello, fmw42!
Happy New Year!
fmw42 wrote: If that does not help, if you can explain what you are trying to do, perhaps we can help correct your command line.
We have three png-images in a folder:
i1.png, i2.png, i3.png.

We need to compose images from a folder in one general image.
Each image will be resized in its own size (-resize 200x200, -resize 90x90, -resize 80x80)

We should save the intermediate results in a memory.
In each composite-command will be used its own -geometry (-geometry +10+90, -geometry +90+20)

Last general image should be saved on disk as png file.

Example:
Image


Can you help write correct optimized command?

Re: How to get rid of the errors?

Posted: 2016-01-01T13:46:11-07:00
by fmw42
Send the individual 3 images and tell me where the two smaller images are to be placed in the larger image. If the placement is different for each size, then send where each is to be placed for that size.

Re: How to get rid of the errors?

Posted: 2016-01-01T14:10:38-07:00
by excel
fmw42 wrote:Send the individual 3 images and tell me where the two smaller images are to be placed in the larger image. If the placement is different for each size, then send where each is to be placed for that size.
i1.png
Image

i2.png
Image

i3.png
Image


This code works:

Code: Select all

exec("convert -resize 200x200 i1.png -write mpr:final_1 +delete -respect-parentheses \
\( convert -resize 90x90 i2.png -write mpr:mem_1 +delete -respect-parentheses \) \
\( convert -resize 80x80 i3.png -write mpr:mem_2 +delete -respect-parentheses \) \
\( mpr:final_1 mpr:mem_1 -geometry +10+90 -composite +write mpr:final_2 \) \
\( mpr:final_2 mpr:mem_2 -geometry +90+20 -composite +write result.png \)");
result.png
Image

But there are errors:

convert: unable to open image `convert': No such file or directory @ error/blob.c/OpenBlob/2701.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501.
convert: unable to open image `convert': No such file or directory @ error/blob.c/OpenBlob/2701.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501.
convert: unbalanced parenthesis `)' @ error/convert.c/ConvertImageCommand/3236.

We need exactly the same result.png but without errors.

Re: How to get rid of the errors?

Posted: 2016-01-01T14:13:42-07:00
by fmw42
I do not understand your code nor why it would even work. And you seem to get only one output.

Please tell me each size you want output and the placements of the two images on the background for each size. Or if you want just one placement on the largest size, I can resize the results to each smaller size.

Never mind. I think I understand what you want.

Re: How to get rid of the errors?

Posted: 2016-01-01T14:18:23-07:00
by fmw42
try this:

Code: Select all

convert \
\( i1.png -resize 200x200 \) \
\( i2.png -resize 90x90 \) -geometry +10+90 -compose over -composite \
\( i3.png -resize 80x80 \) -geometry +90+20 -compose over -composite \
result.png
see
http://www.imagemagick.org/Usage/layers/#convert

Re: How to get rid of the errors?

Posted: 2016-01-01T14:34:11-07:00
by excel
fmw42 wrote:try this:

Code: Select all

convert \
\( i1.png -resize 200x200 \) \
\( i2.png -resize 90x90 \) -geometry +10+90 -compose over -composite \
\( i3.png -resize 80x80 \) -geometry +90+20 -compose over -composite \
result.png

Thank you very much!
It works great!