Discussion:
Error with cg output and ImageMagick
(too old to reply)
Matthew Argall
2013-08-01 21:47:49 UTC
Permalink
ImageMagick is giving me an error whenever I try to use Output. Anyone know what is going on?

convert: bad parameters to zlib `/var/tmp/magick-5612FLG4wulHookp1' @ error/png.c/MagickPNGErrorHandler/1804.
convert: corrupt image `/var/tmp/magick-5612FLG4wulHookp1' @ error/png.c/ReadPNGImage/4048.
convert: Postscript delegate failed `/Users/argall/Desktop/Analysis/20040406/E_Power_LMN_C1_20040406_040600_050900.ps': No such file or directory @ error/ps.c/ReadPSImage/837.
convert: no images defined `PNG24:/Users/argall/Desktop/Analysis/20040406/E_Power_LMN_C1_20040406_040600_050900.png' @ error/convert.c/ConvertImageCommand/3106.


My problem is similar to the one posted here:

https://groups.google.com/forum/#!searchin/comp.lang.idl-pvwave/imagemagick/comp.lang.idl-pvwave/hxKwX-Vzt-k/spOQf2tNArQJ

The solution there was to check permissions and install ghostscript. I have access and ghostcript is installed.
David Fanning
2013-08-01 22:04:44 UTC
Permalink
Post by Matthew Argall
https://groups.google.com/forum/#!searchin/comp.lang.idl-pvwave/imagemagick/comp.lang.idl-pvwave/hxKwX-Vzt-k/spOQf2tNArQJ
The solution there was to check permissions and install ghostscript. I have access and ghostcript is installed
I think the question is, does ImageMagick know where Ghostscript is?

If this were me, I would uninstall both. Then, install GhostScript and
make sure it is working. Then install ImageMagick and make sure it
works. Take any good PostScript file and test from inside of IDL. You
could use cgPStoRaster for this step.

What kind of machine are you on?

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Matthew Argall
2013-08-01 23:12:44 UTC
Permalink
Post by David Fanning
What kind of machine are you on?
{ x86_64 darwin unix Mac OS X 8.0 Jun 17 2010 64 64}
Post by David Fanning
If this were me, I would uninstall both [...]
Might take me a while to uninstall/install. Still not great working in the terminal... For now, in cgCmdWindow::AutoRasterFile, I set rastertype=0 to use cgSnapShot instead of ImageMagick.
David Fanning
2013-08-01 23:40:38 UTC
Permalink
Post by Matthew Argall
Post by David Fanning
What kind of machine are you on?
{ x86_64 darwin unix Mac OS X 8.0 Jun 17 2010 64 64}
Post by David Fanning
If this were me, I would uninstall both [...]
Might take me a while to uninstall/install. Still not great working in the terminal... For now, in cgCmdWindow::AutoRasterFile, I set rastertype=0 to use cgSnapShot instead of ImageMagick.
Well, on Macs there are additional problems with ImageMagick and, I
would imagine, Ghostscript, too:

http://www.idlcoyote.com/cg_tips/findimonmac.php

I personally think this is a Ghostscript problem.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Barry Lesht
2013-12-29 01:45:04 UTC
Permalink
Post by Matthew Argall
ImageMagick is giving me an error whenever I try to use Output. Anyone know what is going on?
I was wondering if there was any more information about this problem. I use IDL v8.2.3 on a Mac (OSX 10.8.5) and would like to use the Coyote graphics 'cgPS_Open', 'cgPS_Close, /PNG' sequence. As happened to the original poster, when I tried a simple example, I got the "convert: bad parameters..." etc. messages. I have both ImageMagick and ghostscript installed (and have uninstalled and re-installed them as David suggested). Working from within ImageMagick I can successfully convert a .PS image to .PNG which would suggest that ImageMagick is communicating correctly with ghostscript. I also have tried using the GS_PATH keyword to be sure IDL knows where ghostscript (gs) is installed but this doesn't seem to make any difference.

By the way, I've been launching the development environment from the command line so IDL knows the location of Imagemagick (cgHasImageMagick() = 1).

Has anyone found a solution to this?
Post by Matthew Argall
https://groups.google.com/forum/#!searchin/comp.lang.idl-pvwave/imagemagick/comp.lang.idl-pvwave/hxKwX-Vzt-k/spOQf2tNArQJ
The solution there was to check permissions and install ghostscript. I have access and ghostcript is installed.
David Fanning
2013-12-29 14:53:52 UTC
Permalink
Post by Barry Lesht
Post by Matthew Argall
ImageMagick is giving me an error whenever I try to use Output. Anyone know what is going on?
I was wondering if there was any more information about this problem. I use IDL v8.2.3 on a Mac (OSX 10.8.5) and would like to use the Coyote graphics 'cgPS_Open', 'cgPS_Close, /PNG' sequence. As happened to the original poster, when I tried a simple example, I got the "convert: bad parameters..." etc. messages. I have both ImageMagick and ghostscript installed (and have uninstalled and re-installed them as David suggested). Working from within
ImageMagick I can successfully convert a .PS image to .PNG which would suggest that ImageMagick is communicating correctly with ghostscript. I also have tried using the GS_PATH keyword to be sure IDL knows where ghostscript (gs) is installed but this doesn't seem to make any difference.
Post by Barry Lesht
By the way, I've been launching the development environment from the command line so IDL knows the location of Imagemagick (cgHasImageMagick() = 1).
Has anyone found a solution to this?
Since this is a "file not found" message, I wonder if you have
permission to write the PostScript file in that directory. That is the
only reason I can think of that it wouldn't be found there.

Try writing the PostScript file to your local home directory and see if
that helps.

If this is not the problem, then I would set the ShowCmd keyword on
cgPS_Close so you can see the ImageMagick command that is spawned. I
would tease that command apart at the UNIX command line to see if you
can figure out what ImageMagick thinks is wrong with it.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
Barry Lesht
2013-12-29 15:15:16 UTC
Permalink
Good morning, David. Thanks. No joy, I'm afraid (see below). I issued the same convert command directly from the shell (outside of IDL) and it works perfectly. I guess the next step is to chase down the source for ps.c and see what's going on there.

If you don't mind a (slightly) related question. In your example code "avi_movie.pro" what is the reason for going through the intermediate step of creating the postscript file? Is it to ensure that the output PNG is higher quality?

Thanks, Barry

bash-3.2$ idl
IDL Version 8.2.3, Mac OS X (darwin x86_64 m64). (c) 2013, Exelis Visual Information Solutions, Inc.
Installation number: 230343.
Licensed for use by: Computer Sciences Corporation

IDL> cgPS_Open, Filename='/Users/blesht/test1.ps'
% Compiled module: CGPS_OPEN.
% Compiled module: CGPS_SETUP__DEFINE.
% Compiled module: CGROOTNAME.
% Compiled module: CGWINDOW_GETDEFS.
% Compiled module: CGWINDOW_SETDEFS.
% Compiled module: CGHASIMAGEMAGICK.
% Compiled module: SETDEFAULTVALUE.
% Compiled module: CGDEFCHARSIZE.
% Compiled module: PSWINDOW.
% Compiled module: CGPS_CONFIG.
% Compiled module: FSC_PSCONFIG__DEFINE.
PostScript output will be created here: /Users/blesht/test1.ps
IDL> cgHistoplot, cgDemoData(7), /Fill
% Compiled module: CGDEMODATA.
% Compiled module: CGHISTOPLOT.
% Compiled module: CONVERT_TO_TYPE.
% Compiled module: CGDEFAULTCOLOR.
% Compiled module: CGGETCOLORSTATE.
% Compiled module: CGSETCOLORSTATE.
% Compiled module: CGCOLOR.
% Compiled module: CGCOLOR24.
% Compiled module: CGCHECKFORSYMBOLS.
IDL> cgPS_Close, /PNG, GS_PATH='/opt/local/bin/', /ShowCmd
% Compiled module: CGPS_CLOSE.
% Compiled module: CGFIXPS.
% Compiled module: CGPS2RASTER.
ImageMagick CONVERT command: convert -alpha off -density 300 "/Users/blesht/test1.ps" -resize 25% -flatten -rotate 90 "PNG24:/Users/blesht/test1.png"
convert: bad parameters to zlib `/var/tmp/magick-25728Qdeiv36tFX2d1' @ error/png.c/MagickPNGErrorHandler/1804.
convert: corrupt image `/var/tmp/magick-25728Qdeiv36tFX2d1' @ error/png.c/ReadPNGImage/4051.
convert: Postscript delegate failed `/Users/blesht/test1.ps': No such file or directory @ error/ps.c/ReadPSImage/837.
convert: no images defined `PNG24:/Users/blesht/test1.png' @ error/convert.c/ConvertImageCommand/3144.
Barry Lesht
2013-12-29 16:55:44 UTC
Permalink
One more quick test (based on cgPS2Raster.pro):

1. Run convert directly from shell (no problem)
2. Enter IDL from command line
3. Run 'which spawn' to verify convert can be found
4. Create string variable 'cmd' with same convert command issued from shell
5. Run 'spawn, cmd' (fails)

bash-3.2$ convert /Users/blesht/test1.ps /Users/blesht/test1a.png
bash-3.2$ idl
IDL Version 8.2.3, Mac OS X (darwin x86_64 m64). (c) 2013, Exelis Visual Information Solutions, Inc.
Installation number: 230343.
Licensed for use by: Computer Sciences Corporation

IDL> spawn, 'which convert'
/opt/local/bin/convert
IDL> cmd = 'convert /Users/blesht/test1.ps /Users/blesht/test1b.png'
IDL> spawn, cmd
convert: bad parameters to zlib `/var/tmp/magick-270976m_aCGY8JmDu1' @ error/png.c/MagickPNGErrorHandler/1804.
convert: corrupt image `/var/tmp/magick-270976m_aCGY8JmDu1' @ error/png.c/ReadPNGImage/4051.
convert: Postscript delegate failed `/Users/blesht/test1.ps': No such file or directory @ error/ps.c/ReadPSImage/837.
convert: no images defined `/Users/blesht/test1b.png' @ error/convert.c/ConvertImageCommand/3144.

Now I'm wondering about the /var/tmp/magick-... No such file exists in /var/tmp. I suppose it could have been deleted with the failure. Permissions are not a problem for /var/tmp.

bash-3.2$ ls -l /var/tmp
total 0
drwxr-xr-x 3 root wheel 102 Dec 28 10:32 com.WD.SmartwareDriveService
drwxr-xr-x 3 root wheel 102 Nov 30 09:54 com.WD.WDRAIDDriveService
drwx------ 3 root wheel 102 Dec 28 10:31 launchd
Matthew Argall
2013-12-29 20:38:11 UTC
Permalink
I took the same initial steps as you and had similar luck... But now it looks like you caught something I did not. If you figure this out, please post the solution. I am very eager so fix this!
Barry Lesht
2013-12-29 21:42:02 UTC
Permalink
Hi Matthew - you bet. I'm hoping that someone with a better knowledge of the workings of IDL than I have can chip in. At this point, at least the problem is a bit more constrained. For some reason the ImageMagick 'convert' command generated through the IDL 'spawn' procedure behaves differently than it does when it is issued directly from the shell. I think this points to IDL as the problem (rather than to ImageMagick/ghostscript) but am not sure about that.
David Fanning
2013-12-30 00:12:57 UTC
Permalink
Post by Barry Lesht
Hi Matthew - you bet. I'm hoping that someone with a better knowledge of the workings of IDL than I have can chip in. At this point, at least the problem is a bit more constrained. For some reason the ImageMagick 'convert' command generated through the IDL 'spawn' procedure behaves differently than it does when it is issued directly from the shell. I think this points to IDL as the problem (rather than to ImageMagick/ghostscript) but am not sure about that.
This suggests to me that the "environment" is not being passed to IDL
when the IDLDE is starting up. I don't really know which environment
variables are not being set, or even how to set them on the Mac. We will
have to wait for more Mac expertise, I guess. :-(

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Barry Lesht
2013-12-30 01:27:16 UTC
Permalink
Yes, David. That's a mystery to me as well. However, the problem occurs when the development environment is launched from the command line and also when I use IDL directly from the command line. Even more curious is that some ImageMagick commands work fine from within IDL.

For instance, issuing SPAWN, 'gs /Users/blesht/test1.ps' brings up an x-window with the plot. SPAWN, 'display' brings up an x-window with the ImageMagick icon but attempting to load the /Users/blesht/test1.ps fails. Of course, it works fine from the shell. Maybe I should see if I can explore the environmental variables from within and without IDL.

Nice way to spend a Sunday!

Best, Barry
Post by David Fanning
Post by Barry Lesht
Hi Matthew - you bet. I'm hoping that someone with a better knowledge of the workings of IDL than I have can chip in. At this point, at least the problem is a bit more constrained. For some reason the ImageMagick 'convert' command generated through the IDL 'spawn' procedure behaves differently than it does when it is issued directly from the shell. I think this points to IDL as the problem (rather than to ImageMagick/ghostscript) but am not sure about that.
This suggests to me that the "environment" is not being passed to IDL
when the IDLDE is starting up. I don't really know which environment
variables are not being set, or even how to set them on the Mac. We will
have to wait for more Mac expertise, I guess. :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
David Fanning
2013-12-30 14:43:39 UTC
Permalink
Post by Barry Lesht
Yes, David. That's a mystery to me as well. However, the problem occurs when the development environment is launched from the command line and also when I use IDL directly from the command line. Even more curious is that some ImageMagick commands work fine from within IDL.
For instance, issuing SPAWN, 'gs /Users/blesht/test1.ps' brings up an x-window with the plot. SPAWN, 'display' brings up an x-window with the ImageMagick icon but attempting to load the /Users/blesht/test1.ps fails. Of course, it works fine from the shell. Maybe I should see if I can explore the environmental variables from within and without IDL.
The problem is not unknown, apparently. Here is how some DRUPLE users
solved it:

https://drupal.org/node/519348

JAVA users have also reported the problem:

http://stackoverflow.com/questions/14249921/imagemagick-cant-open-
file-when-executed-from-java-servlet

Since everyone isn't reporting it, I wonder if it is a ImageMagick
version problem? What version are you using? I'm using 6.7.6-3.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Barry Lesht
2013-12-30 15:16:18 UTC
Permalink
Hi - I'm using ImageMagick 6.8.8-0 (recently re-installed [per your suggestion] via Macports). If I correctly understand the Drupal thread you pointed to, the workaround seems to be to use an older (much older?) version of ImageMagick. I'm afraid I'm not getting much from the Java discussion.

Yesterday, I did try running the convert command with the -debug and configure options set from both the shell and from within IDL. The output is identical (not counting time stamps, etc.) except for the following additional lines that appeared when run from IDL:

2013-12-29T16:27:59-06:00 0:00.160 0.000u 6.8.8 Configure convert[30304]: locale.c/LoadLocaleList/1095/Configure
Loading locale configure file "/opt/local/share/ImageMagick-6/locale.xml" ...
2013-12-29T16:27:59-06:00 0:00.160 0.010u 6.8.8 Configure convert[30304]: locale.c/LoadLocaleList/1095/Configure
Loading locale configure file "/opt/local/share/ImageMagick-6/english.xml" ...
convert: bad parameters to zlib `/var/tmp/magick-30304gpoS2aCnTjOh1' @ error/png.c/MagickPNGErrorHandler/1804.
convert: corrupt image `/var/tmp/magick-30304gpoS2aCnTjOh1' @ error/png.c/ReadPNGImage/4051.
convert: Postscript delegate failed `/Users/blesht/test1.ps': No such file or directory @ error/ps.c/ReadPSImage/837.
convert: no images defined `/Users/blesht/test1.png' @ error/convert.c/ConvertImageCommand/3144.

Barry
David Fanning
2013-12-30 15:37:28 UTC
Permalink
Post by Barry Lesht
Hi - I'm using ImageMagick 6.8.8-0 (recently re-installed [per your suggestion] via Macports). If I correctly understand the Drupal thread you pointed to, the workaround seems to be to use an older (much older?) version of ImageMagick. I'm afraid I'm not getting much from the Java discussion.
2013-12-29T16:27:59-06:00 0:00.160 0.000u 6.8.8 Configure convert[30304]: locale.c/LoadLocaleList/1095/Configure
Loading locale configure file "/opt/local/share/ImageMagick-6/locale.xml" ...
2013-12-29T16:27:59-06:00 0:00.160 0.010u 6.8.8 Configure convert[30304]: locale.c/LoadLocaleList/1095/Configure
Loading locale configure file "/opt/local/share/ImageMagick-6/english.xml" ...
Humm. What happens if you try converting to JPEG files instead of PNG
files? Anything different about that?

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Barry Lesht
2013-12-30 16:01:01 UTC
Permalink
Interesting (maybe, I think). Here is the output:

IDL> spawn, 'convert /Users/blesht/test1.ps /Users/blesht/test1.jpg'
convert: bad parameters to zlib `/var/tmp/magick-38329JSFNnPDnhRZr1' @ error/png.c/MagickPNGErrorHandler/1804.
convert: corrupt image `/var/tmp/magick-38329JSFNnPDnhRZr1' @ error/png.c/ReadPNGImage/4051.
convert: Postscript delegate failed `/Users/blesht/test1.ps': No such file or directory @ error/ps.c/ReadPSImage/837.
convert: no images defined `/Users/blesht/test1.jpg' @ error/convert.c/ConvertImageCommand/3144.

I don't know why ImageMagick still seems to be invoking the 'PNG' routines. The same command works fine from the shell. By the way, I tried to compare the environmental variables (using the printenv) command from inside and outside of IDL. They are essentially the same (though IDL adds its directory to the path).
Barry Lesht
2013-12-30 16:04:24 UTC
Permalink
And continuing, same problem (from within IDL) using pdf or tiff. I'll start poking around for zlib issues.
David Fanning
2013-12-30 16:15:46 UTC
Permalink
Post by Barry Lesht
And continuing, same problem (from within IDL) using pdf or tiff. I'll start poking around for zlib issues.
I wonder if writing a bash script and running that from IDL might work
as a work-around. Company is still here, however, so I doubt I can get
to this today. Too much research involved. :-)

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
David Fanning
2013-12-30 16:29:10 UTC
Permalink
Post by David Fanning
Post by Barry Lesht
And continuing, same problem (from within IDL) using pdf or tiff.
I'll start poking around for zlib issues.
Post by David Fanning
I wonder if writing a bash script and running that from IDL might work
as a work-around. Company is still here, however, so I doubt I can get
to this today. Too much research involved. :-)
I wonder if this page might be helpful:

http://www.libpng.org/pub/png/libpng.html

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Barry Lesht
2013-12-30 17:04:20 UTC
Permalink
Version of libpng available through MacPorts is 1.6.7, not the recent 1.6.8. Probably worth a try to install the 1.6.8.
Barry Lesht
2013-12-30 16:59:58 UTC
Permalink
You've gone "above and beyond" already. By all means enjoy your visitors and the rest of the holiday week. I've gotten around this by writing directly to png (rather than go through an intermediate ps file) for the animation I'm working on. I'm still not sure why the intermediate step is useful, but I trust that it is because you chose to use it.
David Fanning
2013-12-30 17:19:24 UTC
Permalink
Post by Barry Lesht
You've gone "above and beyond" already. By all means enjoy your visitors and the rest of the holiday week. I've gotten around this by writing directly to png (rather than go through an intermediate ps file) for the animation I'm working on. I'm still not sure why the intermediate step is useful, but I trust that it is because you chose to use it.
I use PostScript intermediate files to create nice fonts. That's pretty
much the only reason for it.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
David Fanning
2013-12-30 16:09:50 UTC
Permalink
Post by Barry Lesht
IDL> spawn, 'convert /Users/blesht/test1.ps /Users/blesht/test1.jpg'
I don't know why ImageMagick still seems to be invoking the 'PNG' routines. The same command works fine from the shell. By the way, I tried to compare the environmental variables (using the printenv) command from inside and outside of IDL. They are essentially the same (though IDL adds its directory to the path).
I am beginning to think this is a problem with one of the compression
libraries ImageMagick relies on. Maybe something like lib32-libpng15.

What about creating a file that doesn't require compression. Maybe a
TIFF file or a PDF file?

Another person in the ImageMagick forums reported that he solved a
similar problem by uninstalling, then reinstalling the zlib package.
Maybe the problem lies there.

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Barry Lesht
2014-01-01 21:26:57 UTC
Permalink
One more quirky part of this story; converting to PNG from other image formats (except PS) seems to work fine. That is

IDL> spawn, 'convert test.gif test.png'

results in the correct image.
David Fanning
2014-01-01 22:03:56 UTC
Permalink
Post by Barry Lesht
One more quirky part of this story; converting to PNG from other image formats (except PS) seems to work fine. That is
IDL> spawn, 'convert test.gif test.png'
results in the correct image.
Well, this narrows things considerably, as this operation is all done in
ImageMagick. But, the PostScript part of ImageMagick is done with
Ghostscript. In other words, to work with PostScript files, ImageMagick
has dependencies on Ghostscript.

Old Ghostscript version, maybe?

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Barry Lesht
2014-01-01 23:35:47 UTC
Permalink
Hi - I think this is the current version of ghostscript

bash-3.2$ port installed ghostscript
The following ports are currently installed:
ghostscript @9.10_2+x11 (active)
bash-3.2$ gs -version
GPL Ghostscript 9.10 (2013-08-30)
Copyright (C) 2013 Artifex Software, Inc. All rights reserved.
Matthew Argall
2014-01-08 02:36:29 UTC
Permalink
I got a tip recommending I install Ghostscript and ImageMagick with MacPorts. I did, but still no luck.

On the other hand, I found the following link. Seems like it could be the trick, but I am not entirely sure how to put it into practice for non-server packages...

http://www.mindthegapp.com/?p=2156
Matthew Argall
2014-01-08 21:46:21 UTC
Permalink
I do not know how ImageMagick uses GhostScript, but invoking GhostScript directly works for me.

IDL> spawn, 'gs -dNOPAUSE -dBATCH -sDEVICE=jpeg -sOutputFile="test.png" test.ps'
Barry Lesht
2014-01-08 21:46:11 UTC
Permalink
Hi Matthew - I also installed both ghostscript and ImageMagick with MacPorts. I don't follow the discussion in the link you supplied about doing the installation on an Enterprise server, but my system doesn't have anything like .../plugins/ImageMagick. The only difference I noted in the instructions was the order in which ghostscript and ImageMagick were installed - I think I did it the other way around; doing ghostscript first and then ImageMagick. This was following David's suggestion that ImageMagick needed to "know" about ghostscript when it was installed. Because this seems to be an IDL Mac-specific problem, I posted a query on the Exelis IDL forum. They were able to reproduce the problem, but have not come up with an explanation (or solution).

Barry
Matthew Argall
2014-01-08 22:16:48 UTC
Permalink
I found the thread. Thanks for letting me know!

The link I showed interested me because hints at a system variable within ImageMagick pointing to "convert". However, your thread shows the problem is particularly with convert, not necessarily with ImageMagick.

IDL has been including GZIP and ZLIB functions in its 8.x releases. Would that mean they also include a (different) version of zlib within the IDL distribution?

Ok, I will stop speculating and watch the IDL forum :)

(if anyone else is interested... http://www.exelisvis.com/Support/Forums/tabid/184/forumid/7/threadid/15101/scope/posts/Default.aspx )
Barry Lesht
2014-01-08 21:50:02 UTC
Permalink
That works for me too. Barry
David Fanning
2014-01-15 21:48:00 UTC
Permalink
Folks,

Here is some more info on the Mac "Spawn ImageMagick" problem. I just
had one more report of the same problem. This person had no trouble
spawning ImageMagick before and has used Coyote Graphics for a long
time. Then, he upgraded ImageMagick via macports. (I don't really know
what this means, I'm just reporting what he told me.) As soon as he
upgraded, he had the problem.

Here is what he had:

OLD:
ImageMagick @6.8.7-7_0+x11 (active) platform='darwin 13' archs='x86_64'

NEW:
ImageMagick @6.8.8-0_1+x11 (active) platform='darwin 13' archs='x86_64'

Other things were changed in the mapport upgrade. I have before and
after print-outs, if you think that will be helpful.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
David Fanning
2014-01-15 21:58:05 UTC
Permalink
Post by David Fanning
Here is some more info on the Mac "Spawn ImageMagick" problem. I just
had one more report of the same problem. This person had no trouble
spawning ImageMagick before and has used Coyote Graphics for a long
time. Then, he upgraded ImageMagick via macports. (I don't really know
what this means, I'm just reporting what he told me.) As soon as he
upgraded, he had the problem.
Other things were changed in the mapport upgrade. I have before and
after print-outs, if you think that will be helpful.
In this same macports update, GhostView (which I suspect is the culprit,
since only PostScript files are involved) changed from this:

ghostscript @9.10_1+x11 (active) platform='darwin 13' archs='x86_64'

To this:

ghostscript @9.10_2+x11 (active) platform='darwin 13' archs='x86_64'

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
David Fanning
2014-01-16 02:44:49 UTC
Permalink
Folks,

OK, Mac users who can't spawn ImageMagick. I think there is a very good
chance answer number 321 on this page might solve our problems:

http://stackoverflow.com/questions/135688/setting-environment-
variables-in-os-x

I think you have to include whatever paths ImageMagick needs here. Let
me know. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
David Fanning
2014-01-16 13:58:38 UTC
Permalink
Post by David Fanning
OK, Mac users who can't spawn ImageMagick. I think there is a very good
http://stackoverflow.com/questions/135688/setting-environment-
variables-in-os-x
I think you have to include whatever paths ImageMagick needs here. Let
me know. :-)
OK, I think we are hot on the solution to this problem now!

The problem is how the Mac OS X deals with environment variables. It is
*extremely* complex. It also has to do with how the application is
invoked. Since I don't have a Mac, much of this is a mystery to me. (As
it is to a great many people who *do* have a Mac.) But, I'm convinced
now this is where the solution lies.

See answer 12 on this page:

http://stackoverflow.com/questions/135688/setting-environment-variables-
in-os-x/5444960#5444960

To solve this problem, we need the paths to ImageMagick and GhostScript
in both enviroment.plist *and* in launchd.conf. Can anyone help us out?
Please!

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
David Fanning
2014-01-16 14:21:21 UTC
Permalink
Post by David Fanning
Post by David Fanning
OK, Mac users who can't spawn ImageMagick. I think there is a very
good
Post by David Fanning
http://stackoverflow.com/questions/135688/setting-environment-
variables-in-os-x
I think you have to include whatever paths ImageMagick needs here. Let
me know. :-)
OK, I think we are hot on the solution to this problem now!
The problem is how the Mac OS X deals with environment variables. It is
*extremely* complex. It also has to do with how the application is
invoked. Since I don't have a Mac, much of this is a mystery to me. (As
it is to a great many people who *do* have a Mac.) But, I'm convinced
now this is where the solution lies.
http://stackoverflow.com/questions/135688/setting-environment-variables-
in-os-x/5444960#5444960
To solve this problem, we need the paths to ImageMagick and GhostScript
in both enviroment.plist *and* in launchd.conf. Can anyone help us out?
Please!
Maybe these environment variables just need to be set in
environment.plist:

https://developer.apple.com/legacy/library/qa/qa1067/_index.html

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Matthew Argall
2014-01-18 17:21:58 UTC
Permalink
I am familiar with setting environment variables in Mac, but am not certain if I am setting the correct ones. I followed the instructions on the install page below, setting MAGICK_HOME, PATH, and DYLD_LIBRARY_PATH, but that has not worked.

http://www.imagemagick.org/script/binary-releases.php#macosx



Also, as a side note (and not really problem), after the errors are generated, cgSnapshot outputs the following message:

Output will be created here: /[directory]/test.bmp

but no output is generated.
Phillip Bitzer
2014-01-20 16:14:17 UTC
Permalink
Post by Matthew Argall
I am familiar with setting environment variables in Mac, but am not certain if I am setting the correct ones. I followed the instructions on the install page below, setting MAGICK_HOME, PATH, and DYLD_LIBRARY_PATH, but that has not worked.
Just to throw another data point out there, I've successfully used ImageMagick on a Mac (in the context of Coyote) on both Snow Leopard and Mountain Lion. On Mountain Lion, I've only used the binary install (no MacPorts) and have never had an issue. Here are my variables/info.

bitzermbp:~ Bitzer$ echo $MAGICK_HOME

bitzermbp:~ Bitzer$ echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/texbin

bitzermbp:~ Bitzer$ echo $DYLD_LIBRARY_PATH
/usr/local/xuggler/lib

bitzermbp:~ Bitzer$ which convert
/usr/local/bin/convert

bitzermbp:~ Bitzer$ gs --version
9.05

bitzermbp:~ Bitzer$ convert --version
Version: ImageMagick 6.7.6-9 2012-05-12 Q16 http://www.imagemagick.org
Barry Lesht
2014-02-24 18:30:35 UTC
Permalink
Phillip - Still trying to get this problem solved.

I see you have /opt/local/bin in your path Where exactly do you install the ImageMagick binary when you do this? MacPorts uses /opt/local/bin. How did convert find its way to /usr/local/bin on your system?

Thanks, Barry
Barry Lesht
2014-02-28 01:47:55 UTC
Permalink
Quick update - Someone on the ImageMagick forum suggested that perhaps IDL "has" (or points to) its own versions of some of the delegate libraries (e.g. gslib, zlib, libpng) that are needed by ImageMagick and there may be a conflict between versions. This seems possible (to me). I just entered a formal support request to Exelis (as opposed to a forum posting) asking if they could assist with the problem. Barry
Barry Lesht
2014-02-28 02:05:30 UTC
Permalink
I don't feel confident about playing with this without expert guidance, but this may be the solution.

In directory /Applications/exelis/idl/bin/bin.darwin.x86_64 we find:

-rwxrwxr-x 1 682 _lpoperator 88096 May 8 2013 libz.1.2.3.dylib
lrwxr-xr-x 1 682 _lpoperator 16 Jul 8 2013 libz.1.dylib -> libz.1.2.3.dylib

In directory /opt/local/lib we have:

-rwxr-xr-x 1 root admin 84532 May 3 2013 libz.1.2.8.dylib
lrwxr-xr-x 1 root admin 16 May 3 2013 libz.1.dylib -> libz.1.2.8.dylib
-rw-r--r-- 1 root admin 100976 May 3 2013 libz.a
lrwxr-xr-x 1 root admin 16 May 3 2013 libz.dylib -> libz.1.2.8.dylib

The current version of zlib is 1.2.8. I suppose one test would be to change the link in the IDL directory to point to the library in /opt/local/lib. I'm afraid that is beyond my skill level.
Barry Lesht
2014-02-28 14:50:12 UTC
Permalink
Changing the link from libz1.2.3 to libz1.2.8 indeed solves the problem.
Matthew Argall
2014-03-03 12:57:32 UTC
Permalink
Post by Barry Lesht
Changing the link from libz1.2.3 to libz1.2.8 indeed solves the problem.
I can confirm that this works. Thanks for getting to the bottom of it!
g***@gmail.com
2014-04-11 22:53:58 UTC
Permalink
Post by Matthew Argall
Post by Barry Lesht
Changing the link from libz1.2.3 to libz1.2.8 indeed solves the problem.
I can confirm that this works. Thanks for getting to the bottom of it!
CAn you be very explicit about which links you have to change. I'm almost there!! please help!!
Matthew Argall
2014-04-12 02:56:23 UTC
Permalink
See David's and/or my post on this thread

https://groups.google.com/forum/#!searchin/comp.lang.idl-pvwave/png$20error$20imagemagic%7Csort:date/comp.lang.idl-pvwave/to6PPlg2RZA/A98-YTD3qOYJ
Loading...