Imagemagick ftp and spaces - linux

Imagemagick provides the identify tool, which works perfectly for what I need. I use it on Ubuntu, with Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114.
Here is how I use it:
$ identify "ftp://SERVERNAME:PASSWORD#HOST/DIRECTORY/FILE.pdf"
But when the directory or file has got a space in the name, I get an error as if it doesn't find the file.
Any solution?
NOTE: I've tried with \, \\, %20 or ^ before spaces, but it doesn't solve this issue.
Error : "identify-im6.q16: no decode delegate for this image format `' # error/constitute.c/ReadImage/504. no data returned"
(same message as if I didn't write the correct name of the file).

Your issue could be because you're using double quotes. Try using single quotes instead around the URL to the FTP server. For example, here I'm using the free FTP service mentioned in this other SO Q&A titled: Is there a Public FTP server to test upload and download?.
$ identify 'ftp://demo:password#test.rebex.net/pub/example/WinFormClient.png'
ftp://demo:password#test.rebex.net/pub/example/WinFormClient.png=>WinFormClient.png PNG 800x700 800x700+0+0 8-bit sRGB 80000B 0.000u 0:00.000
I was able to find another site that allows you to upload files, https://dlptest.com/ftp-test/. In using this, I believe this replicates your issue:
$ identify 'ftp://dlpuser%40dlptest.com:e73jzTRTNqCN9PYAAjjn#ftp.dlptest.com/download with space.jpeg'
identify: no decode delegate for this image format `' # error/constitute.c/ReadImage/512.
identify: no data returned `ftp://dlpuser%40dlptest.com:e73jzTRTNqCN9PYAAjjn#ftp.dlptest.com/download with space.jpeg' # error/url.c/ReadURLImage/246.
This looks like a bug with Imagemagick's handling of URLs. This is the version that I'm using:
$ identify --version
Version: ImageMagick 7.0.8-0 Q16 x86_64 2018-06-13 https://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: https://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib
At any rate I see you've asked in the Imagemagick forums about this issue - Identify ftp and spaces.

Related

Why would ImageMagick & Ghostscript work in CMD but not in PHP?

We are migrating from a Windows 2012 Server to a Windows 2019 server. We have been using ImageMagick as Imagick in PHP and Ghostscript to convert PDF files into JPG files for quite some time without issue, but now on the new server it will not work. This is the error message we receive:
Fatal error: Uncaught ImagickException: FailedToExecuteCommand `"gs" -sstdout=%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r300x300" -dPrinted=false -dFirstPage=1 -dLastPage=1 "-sOutputFile=C:/Windows/TEMP/magick-mkMmFi8vXckWEAzjPQWNNyAeLCmErcUI%d" "-fC:/Windows/TEMP/magick-RHvJ0K3gv-gkEMBSrS8cft5IBz4k5e3f" "-fC:/Windows/TEMP/magick-YHH7fNU9o9vL3dni8YuaJxpvgDWi04hK"' (The system cannot find the file specified. ) # error/delegate.c/ExternalDelegateCommand/516 in C:\inetpub\vhosts\example.com\httpdocs\crons\test.php:1214 Stack trace: #0 C:\inetpub\vhosts\example.com\httpdocs\crons\test.php(1214): Imagick->readImage() #1 {main} thrown in C:\inetpub\vhosts\example.com\httpdocs\crons\test.php on line 1214
We have ImageMagick 7.1.0 installed, Ghostscript 10, and the PHP extension added for Imagick along with the necessary files.
Here is what we have already tried...
ImageMagick and Ghostscript paths are both in the Environmental Variables.
Modified the Delegates.xml for ImageMagick with full path to Ghostscript.
Modified the Policy.xml for ImageMagick to uncomment PDF domain module, including adding "read|write", as well as uncommenting the temporary-path line.
Verified the Ghostscript registery keys exist and point to the correct paths.
Verified all directories had the necessary permissions.
As well as probably some other things we are just forgetting. None of those steps were necessary on the old server.
It DOES work as expected when run from command line as
magick test.pdf test.png
But it will not work when run from PHP.
At this point we are completely stumped. We have been searching and trying suggestions for hours, but nothing seems to work. If anyone has gotten this working and we are just missing something, advice would be so greatly appreciated.
EDIT
I forgot to mention we are running PHP 7.4.3 and everything is 64bit (Windows, IIS, PHP, ImageMagick, Ghostscript).
We can also use exec("gswin64c --help", $array); in PHP to display info about Ghostscript with no errors. So the issue is just that the PHP imagick extension can't seem to access Ghostscript.

pstoedit does not create svg

In reality, I detected the original problem when using Inkscape 0.91 - it has an option to render Latex images on an SVG surface. Digging a little, it seems that the problem is due to pstoedit failing, which, when called separately reports:
$ pstoedit -f svg test.ps test.svg
pstoedit: version 3.70 / DLL interface 108 (built: Sep 25 2017 - release build - g++ 4.9.3 - 64-bit) : Copyright (C) 1993 - 2014 Wolfgang Glunz
Unsupported output format svg
Digging still deeper, it seems that pstoedit uses plotutils to do the work, but, from tests, plotutils seems to do what it is supposed to do:
echo 0 0 1 1 2 0 | spline | graph > test.meta
succesfully creates a test.meta file with a spline in it, while
plot -T svg test.meta > test.svg
converts that metafile correctly to test.svg
Versions installed are:
plotutls 2.6 (seems Ok, creates svg)
pstoedit 3.7 (works, except for svg)
Inkscape 0.91 (Latex appears in the extensions | render menu
but doesn't work - because pstoedit doesn't generate
the required svg)
I've also reviewed the ./configure options to check if something was missing - no luck.
Distribution is Slackware64-current. As Slackware always installs the header files, no header files (-dev, -devel...) are missing here (I've checked too. And recompiled pstoedit after installing plotutils)
Digging even deeper, I found the reason for the problem. Slackware64 installs libraries to /usr/lib64, so the the pstoedit plugins were installed in /usr/lib64/pstoedit. But it seems that pstoedit does NOT look in that directory when trying to load the plugins at runtime - it looks for /usr/lib/pstoedit instead.
It then reports supporting several formats except svg - giving the impression it did find some plugins. In a Debian bug report I found that the reporter checked the plugin search using the -verbose command line option, which doesn't exit (it's just -v)
Anyway, I solved the issue (for the moment) by making a symlink from /usr/lib/pstoedit to /usr/lib64/pstoedit. I'll send a report to the program author too.

Gromacs: .ene extension not recognized

I'm new to Gromacs (and protein-analysis coding in general, but have some experience with python-based code). I'm trying to convert a .ene file received from pyDock to a more readable format (it currently opens
When I try to use different commands that the gromacs guide says accept .ene files (gmx eneconv and gmx dump), for example
gmx eneconv -f project.ene -o converted.edr
and
gmx dump -e project.ene -om read.mdp
I get the error
File 'project.ene' cannot be used by GROMACS because it does not have a recognizable extension.
The following extensions are possible for this option:
.edr
I have updated my OS and re-installed gromacs. My installation is working according to the 'Getting Started' page.
I am also open to suggestions for other programs to open and read the .ene file type.
Thanks!
"ene" is short for "energy" which contains binary data for energy, temperature, volume, etc, and is only used in older version of Gromacs. In new version of Gromacs this is replaced by "edr" file which contains portable binary data. See "gmx dump -h", you will find the following lines:
Options to specify output files:
-o [<.edr>] (fixed.edr)
Energy file
If you insist on using ene file, you should install an older version of Gromacs.

Installing Image Magick with Ghostscript

Hello fellow Stackers,
Currently I am working on a website which requires the ability to handle, manipulate, create and save PostScript encoded files. Research on the topic pointed me towards two PHP classes called Imagick and MagickWand – both of which use Image Magick, which in turn depends on Ghostscript. Unfortunately the GD PHP class is not up to the task.
I am performing the installation processes on a server running GNU/Linux via SSH from my Mac with OS X 10.9.1. Any help would be much appreciated. If any other details are needed, please inform me and I will do my absolute best to provide them.
Thus far, I have managed to make Image Magick and Ghostscript function independently – while simultaneously installed on the same system. However I was not able to install Ghostscript accordingly for it to function as an Image Magick delegate. From Terminal I was able to run the convert and gs commands successfully. At the time I was able to use the Imagick PHP class to perform the required tasks – such as detecting Color Space – on rasterised images.
As it stands Image Magick has been uninstalled from the server. I was not able to uninstall Ghostscript correctly. So my first question is: how on earth do I uninstall Ghostscript 9.10? It seems Ghostscript does not include an uninstall in its Makefile, ie: make uninstall returns make: *** No rule to make target 'uninstall'. Stop..
I have done some research and it seems that I should have compiled the Ghostscript shared library first: http://www.linuxfromscratch.org/blfs/view/svn/pst/gs.html
Naturally I attempted to perform the steps in the article on Linux from Scratch. I have removed expat, freetype, lcms2, jpeg and libpng. I have performed ./configure with the suggested commands. I have also performed make and make so, both of which fail and exit, returning:
pngrutil.c:(.text+0x3cb): undefined reference to 'inflateReset2'
collect2: ld returned 1 exit status
make: *** [bin/gs] Error 1.
edit: I have since narrowed this down to be related to Zlib.
I am looking for either an alternative to Imagick and MagickWand (which I was not able to find), insights into what is going wrong during the installation process or what might be done to resolve the current error.
Thank you all in advance.
A manual process to uninstall may be required if there is no uninstall defined for the makefile.
This has been discussed in the question What's the opposite of 'make install', ie. how do you uninstall a library in Linux?.
I ditched the idea of using Ghostscript as an Image Magick Delegate, not only because the installation process was not working out for but, but also due to the fact that my research taught me that Image Magick rasterises all input files.
Instead I used the PHP exec() function to directly execute Ghostscript.

ImageMagick -liquid-rescale option error

I want to use Seam Carving, and found ImageMagick maybe a good choice.
Then I install ImageMagick from source as this indicate.
My problem is: When I type the command
convert logo_trimmed.jpg -liquid-rescale 75x100%\! logo_lqr.jpg
it gives the following error:
convert: delegate library support not built-in 'logo_trimmed.jpg' (LQR) # error/resize.c/LiquidRescaleImage/1900.
I thought it may because lack of liblqr support, so I go to Liquid Rescale to install it
and then make uninstall ImageMagick and install it again.
However, problem remains the same.
Can anyone tell me how to make convert -liquid-rescale works?
Thanks for any hint.
After installing liblqr, you have to install imagemagick by running configure prior to make, see build instructions here:
http://www.imagemagick.org/script/install-source.php#unix
If you don't run configure it will not pick your new library.
And after you've compiled imagemagick check that LQR delegate library was installed by running:
convert -list configure | grep -i "delegates"
and seeing LQR listed there.

Resources