Error with cg output and ImageMagick [message #85419] |
Thu, 01 August 2013 14:47  |
Matthew Argall
Messages: 286 Registered: October 2011
|
Senior Member |
|
|
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_2004 0406_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_C 1_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-pvw ave/imagemagick/comp.lang.idl-pvwave/hxKwX-Vzt-k/spOQf2tNArQ J
The solution there was to check permissions and install ghostscript. I have access and ghostcript is installed.
|
|
|
|
|
Re: Error with cg output and ImageMagick [message #85423 is a reply to message #85422] |
Thu, 01 August 2013 16:40   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Matthew Argall writes:
>
>> What kind of machine are you on?
>
> { x86_64 darwin unix Mac OS X 8.0 Jun 17 2010 64 64}
>
>> 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.")
|
|
|
|
Re: Error with cg output and ImageMagick - Has this been solved?? [message #87025 is a reply to message #87024] |
Sun, 29 December 2013 06:53   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Barry Lesht writes:
> On Thursday, August 1, 2013 4:47:49 PM UTC-5, Matthew Argall wrote:
>> 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_2004 0406_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_C 1_20040406_040600_050900.png' @ error/convert.c/ConvertImageCommand/3106.
>>
>>
>>
> 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?
>
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.")
|
|
|
Re: Error with cg output and ImageMagick [message #87026 is a reply to message #85419] |
Sun, 29 December 2013 07:15   |
BLesht
Messages: 89 Registered: March 2007
|
Member |
|
|
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.
|
|
|
|
|
|
|
Re: Error with cg output and ImageMagick [message #87033 is a reply to message #87030] |
Sun, 29 December 2013 17:27   |
BLesht
Messages: 89 Registered: March 2007
|
Member |
|
|
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
On Sunday, December 29, 2013 6:12:57 PM UTC-6, David Fanning wrote:
> Barry Lesht writes:
>
>
>
>> 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.")
|
|
|
Re: Error with cg output and ImageMagick [message #87035 is a reply to message #87033] |
Mon, 30 December 2013 06:43   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Barry Lesht writes:
>
> 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.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Error with cg output and ImageMagick [message #87065 is a reply to message #87064] |
Wed, 01 January 2014 14:03   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Barry Lesht writes:
> 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.")
|
|
|
|
|
|
|
|
|
|
Re: Error with cg output and ImageMagick [message #87204 is a reply to message #87203] |
Wed, 15 January 2014 13:58   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> 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.
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.")
|
|
|
|
|
|
|
Re: Error with cg output and ImageMagick [message #87242 is a reply to message #87234] |
Mon, 20 January 2014 08:14   |
Phillip Bitzer
Messages: 223 Registered: June 2006
|
Senior Member |
|
|
On Saturday, January 18, 2014 11:21:58 AM UTC-6, Matthew Argall wrote:
> 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
|
|
|
|
|
|
|
|
|
|