How to get rid of the errors?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
excel
Posts: 18
Joined: 2015-12-19T13:16:12-07:00
Authentication code: 1151

How to get rid of the errors?

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to get rid of the errors?

Post 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.
excel
Posts: 18
Joined: 2015-12-19T13:16:12-07:00
Authentication code: 1151

Re: How to get rid of the errors?

Post 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?
Last edited by excel on 2016-01-01T13:58:54-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to get rid of the errors?

Post 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.
excel
Posts: 18
Joined: 2015-12-19T13:16:12-07:00
Authentication code: 1151

Re: How to get rid of the errors?

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to get rid of the errors?

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to get rid of the errors?

Post 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
excel
Posts: 18
Joined: 2015-12-19T13:16:12-07:00
Authentication code: 1151

Re: How to get rid of the errors?

Post 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!
Post Reply