I am having trouble running a unix subshell command to process some IM commands (to make an animation) in IM 6.7.5.6 Q16 Mac OSX Snow Leopard.
The following mostly fails as follows, though infrequently in has worked from time to time. (see viewtopic.php?f=1&t=20317#p80821 and viewtopic.php?f=1&t=20317#p80831)
ww=`convert rose: -format "%w" info:`
hh=`convert rose: -format "%h" info:`
( for ((i=0; i<29; i++)); do
ii=`convert xc: -format "%[fx:-$ww*(1-$i/29)]" info:`
jj=`convert xc: -format "%[fx:-$hh*(1-$i/29)]" info:`
echo "$ii,$jj"
convert -delay 10 rose: -virtual-pixel tile -distort SRT "0,0 1, 0, $ii,$jj" miff:-
done ) | convert - -loop 0 rose_anim4.gif
convert: no decode delegate for this image format `/var/folders/Yy/YyU-87D4F+OjlYS1BLMfS++++TM/-Tmp-/magick-4I1ZkqaD' @ error/constitute.c/ReadImage/532.
convert: missing an image filename `rose_anim4.gif' @ error/convert.c/ConvertImageCommand/3016.
Can someone tell me what this means and how to avoid it? I am not sure if /var/folders is a standard directory? Is it safe to remove subdirectories within /var/folders, such as Yy and its contents? When I cd to the offending directory the file is gone, but there is another directory, TemporaryItems, which is empty.
Thanks.
Fred
puzzling error message
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
puzzling error message
Last edited by fmw42 on 2012-02-15T20:46:31-07:00, edited 1 time in total.
Re: puzzling error message
We cannot reproduce the problem.
Try resetting the temporary path. Use export TMPDIR=/tmp for example. Does the script still fail?
Next try another format instead of MIFF. Try tiff:-, for example, or pam:-. Does the script still fail?
Try resetting the temporary path. Use export TMPDIR=/tmp for example. Does the script still fail?
Next try another format instead of MIFF. Try tiff:-, for example, or pam:-. Does the script still fail?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: puzzling error message
magick wrote:We cannot reproduce the problem.
Try resetting the temporary path. Use export TMPDIR=/tmp for example. Does the script still fail?
Next try another format instead of MIFF. Try tiff:-, for example, or pam:-. Does the script still fail?
Neither help! After exporting TMPDIR=/tmp
printenv
...
TMPDIR=/tmp
...
But now
ww=`convert rose: -format "%w" info:`
hh=`convert rose: -format "%h" info:`
( for ((i=0; i<29; i++)); do
ii=`convert xc: -format "%[fx:-$ww*(1-$i/29)]" info:`
jj=`convert xc: -format "%[fx:-$hh*(1-$i/29)]" info:`
echo "$ii,$jj"
convert -delay 10 rose: -virtual-pixel tile -distort SRT "0,0 1, 0, $ii,$jj" tiff:-
done ) | convert - -loop 0 rose_anim4.gif
convert: no decode delegate for this image format `/tmp/magick-fjLJbJ1A' @ error/constitute.c/ReadImage/532.
convert: missing an image filename `rose_anim4.gif' @ error/convert.c/ConvertImageCommand/3016.
And the file is missing from /tmp
cd /tmp
c-98-234-217-52:tmp fred$ ls -al
total 0
drwxrwxrwt 8 root wheel 272 Feb 15 17:12 .
drwxr-xr-x@ 6 root wheel 204 Apr 27 2010 ..
srwxr-xr-x 1 fred wheel 0 Feb 15 17:12 icssuis502
drwx------ 3 fred wheel 102 Feb 15 17:11 launch-7tbtUD
drwx------ 3 fred wheel 102 Feb 15 17:11 launch-AD7qiD
drwx------ 3 fred wheel 102 Feb 15 17:11 launch-bUZ1iH
drwx------ 3 _cvmsroot wheel 102 Feb 15 17:11 launchd-73.Bc5RSP
drwx------ 3 fred wheel 102 Feb 15 17:11 launchd-93.Y0mgpg
So bottom line is that I still get the error message, but now for the "magick" file in /tmp. It is like it does not get created or gets deleted too quickly.
Fred
P.S. Have you tried on your Mac (Lion? or Snow Leopard?)
Re: puzzling error message
We ran your script hundreds of times under Mac OS X Lion with ImageMagick 6.7.5-6 and each time ran without complaint. We're clueless why its failing for you.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: puzzling error message
It is very strange.
This works fine:
( for ((i=0; i<1; i++)); do
echo "i=$i"
convert -size 1x10 gradient: pam:-
done ) | cat -
But this fails:
( for ((i=0; i<1; i++)); do
echo "i=$i"
convert -size 1x10 gradient: pam:-
done ) | convert - tmp.gif
convert: no decode delegate for this image format `/tmp/magick-9kiSrMqQ' @ error/constitute.c/ReadImage/532.
convert: missing an image filename `tmp.gif' @ error/convert.c/ConvertImageCommand/3016.
Seems to have something to do with convert reading from standard in?
Might there be some permission problem?
Can you think of some other test that might help determine the issue?
Anyway for me to debug that might help find the problem as you cannot reproduce it?
This works fine:
( for ((i=0; i<1; i++)); do
echo "i=$i"
convert -size 1x10 gradient: pam:-
done ) | cat -
But this fails:
( for ((i=0; i<1; i++)); do
echo "i=$i"
convert -size 1x10 gradient: pam:-
done ) | convert - tmp.gif
convert: no decode delegate for this image format `/tmp/magick-9kiSrMqQ' @ error/constitute.c/ReadImage/532.
convert: missing an image filename `tmp.gif' @ error/convert.c/ConvertImageCommand/3016.
Seems to have something to do with convert reading from standard in?
Might there be some permission problem?
Can you think of some other test that might help determine the issue?
Anyway for me to debug that might help find the problem as you cannot reproduce it?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: puzzling error message
Further illuminating Information:
This fails:
( for ((i=0; i<1; i++)); do
echo "i=$i"
convert -size 1x1 xc:white gif:-
done ) | convert - tmp.gif
But removing or commenting out the echo seems to work fine:
( for ((i=0; i<1; i++)); do
convert -size 1x1 xc:white gif:-
done ) | convert - tmp.gif
Am I misunderstand how subshells handle echo?
If not, can you retest my original script at the my first post above. I had tested it with the echo in it, but had removed it when I pasted it into my message as I thought it was just clutter. I have now restored the echo in my first post.
This fails:
( for ((i=0; i<1; i++)); do
echo "i=$i"
convert -size 1x1 xc:white gif:-
done ) | convert - tmp.gif
But removing or commenting out the echo seems to work fine:
( for ((i=0; i<1; i++)); do
convert -size 1x1 xc:white gif:-
done ) | convert - tmp.gif
Am I misunderstand how subshells handle echo?
If not, can you retest my original script at the my first post above. I had tested it with the echo in it, but had removed it when I pasted it into my message as I thought it was just clutter. I have now restored the echo in my first post.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: puzzling error message
Yeapfmw42 wrote:Am I misunderstand how subshells handle echo?
You are having your final convert read from the standard output of the loop a stream of MIFF images.
EG: in this loop...
Code: Select all
for ((i=0; i<1; i++)); do
convert -size 1x1 xc:white miff:-
done | convert - tmp.gif
and so on. MIFF images can be simply concatenated together to make a multiple image, image.MIFF_image MIFF_image MIFF_image ...
You can use MIFF, PBM, PGM, PPM, PAM, TXT image formats, for a concatenated image list.
You can not use GIF, PNG or JPEG as these image file formats do not 'concatenate' into a multi-image list,
but are full defined formats. GIF can have multiple images but does not 'concatenate'
See... http://www.imagemagick.org/Usage/files/#miff
When you add the echo.. The second convert is reading a character stream consisting of....
So it reads one image, then sees the string "i=0" does not recognise it as an image and barfs...MIFF_image i=0 MIFF_image i=1 MIFF_image i=2 ...
no decode delegate for this image format
If you want to echo some information you must NOT echo it the for-loops standard output data stream of images. The best solution is to echo to standard error (file descriptor '2').
As such this will work...
Code: Select all
for ((i=0; i<10; i++)); do
echo >&2 "i=$i"
convert -size 1x1 xc: miff:-
done | convert - tmp.gif
ASIDE; this is why many 'debug' outputs of IM will write to STDERR instead of STDOUT, that way images being piped out does not include that non-image debug info. EG output from things like..
-define distort:verbose=1
-define filter:verbose=1
-define showkernel=1
and in 'most' cases
-verbose
Some text output output in IM goes to standard output. -print -identify But provides no method of changing it a file or stream...
See IM Exmaples, Basics, Identify Alternatives - Text Output Options
http://www.imagemagick.org/Usage/basics/#identify_alt
The coders like info: and txt: also default to STDOUT, can be re-directed files of other file streams. For example info:fd:2 outputs to STDERR.
For example, this works fine to report image info while not effecting the output muilt-image stream.
Code: Select all
for ((i=0; i<10; i++)); do
convert -size 1x1 xc: -write info:fd:2 miff:-
done | convert - tmp.gif
As part of IMv7 CLI updates, I plan of better control of to which file descriptor various debugging output text is to be directed.
Suggestions welcome.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: puzzling error message
Thank you Anthony. I understood the limitations on using multi-frame formats and you told me about doing this kind of looping in a subshell, which I have used in other scripts successfully. What I was not understanding was the echo issue and the need to send it to stderr.
Sorry this got a bit more unix than IM. But I greatly appreciate your help and explanation
Fred
P.S. Magick, thanks for all your help as well. Sorry I lead you down a bogus path leaving the echo out of my first post. However, retesting that code rather than my non-posted test with the echo is what lead me to find that the echo was the issue.
Now this makes sense and solves my problem and misunderstanding.Anthony wrote:for ((i=0; i<10; i++)); do
echo >&2 "i=$i"
convert -size 1x1 xc: miff:-
done | convert - tmp.gif
Sorry this got a bit more unix than IM. But I greatly appreciate your help and explanation
Fred
P.S. Magick, thanks for all your help as well. Sorry I lead you down a bogus path leaving the echo out of my first post. However, retesting that code rather than my non-posted test with the echo is what lead me to find that the echo was the issue.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: puzzling error message
It is easy to do..
I have done it so many times myself in scripting, and the error message is misleading, even though it is accurate!
I have done it so many times myself in scripting, and the error message is misleading, even though it is accurate!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/