I am new to ImageMagick and I am simply trying to run convert command at Command line which is as follows:
convert '/home/674390/Desktop/rose.jpg' '/home/674390/Desktop/rose.png'
Getting an error message:
convert: unable to open image /home/674390/Desktop/rose.jpg': No such
file or directory # error/blob.c/OpenBlob/2643. convert: no decode
delegate for this image format/home/674390/Desktop/rose.jpg' #
error/constitute.c/ReadImage/555. convert: no images defined
`/home/674390/Desktop/rose.png' #
error/convert.c/ConvertImageCommand/3144.
Please help.
My Operating System is CentOS.
There's three errors involved with your convert command.
convert: unable to open image /home/674390/Desktop/rose.jpg': No such file or directory # error/blob.c/OpenBlob/2643.
This means exactly what it says. There is no file at that path, or you do not have read permissions to access it.
convert: no decode delegate for this image format/home/674390/Desktop/rose.jpg' # error/constitute.c/ReadImage/555.
This message is informing you that you'll need to install libjpeg to work with this file format. See ImageMagick Delegates for resources. You can also verify what your system can work with by running the following commands.
convert -list delegate | less
convert -list format | less
Finally
convert: no images defined `/home/674390/Desktop/rose.png' # error/convert.c/ConvertImageCommand/3144.
As the first image could not be opened, convert now believes the distention file is the source file, and attempts to open it for reading. And so, a message identical to the first one is displayed.
Related
I have a large number of images in the INTA format, an old SGI standard. INTA is a grayscale image with an alpha channel. All of these need to be converted to TGA files. The problem is that neither ImageMagick nor PIL/Pillow seem to be able to parse them correctly. ImageMagick can read and export them but doesn't seem to understand the alpha channel, and PIL fails to open them, with the error ValueError: Unsupported SGI image mode. The one thing that I've found that reads them successfully is GIMP:
An ideal solution would be one that is easy to invoke from a script.
For reference, here is one of the images in question (the same one seen in the screenshot): https://www.dropbox.com/s/8hoppdgtuqxsy26/girder01.inta?dl=0
It seems GDAL is able to read your image and I converted it to a greyscale+alpha PNG using:
gdal_convert YOURIMAGE.sgi result.png
You can easily get to TGA from there.
I am assuming the batching is not an issue, but it would look something like this in bash:
mkdir -p OUTPUT
for f in *.inta ; do
gdal_translate "$f" OUTPUT/"$f"
done
I had all sorts of trouble installing GDAL on macOS so I just used docker like this:
docker run --rm -v /Users:/Users osgeo/gdal:alpine-normal-latest gdal_translate /Users/mark/Downloads/image.sgi /Users/mark/Downloads/result.png
So I pulled the snips image from docker hub.
When I run the image, it gives me the error:
standard_init_linux.go:178: exec user process caused "no such file or directory".
Most of the solutions online seem relevant only when the image has been previously built. However, in my case, I've just pulled the image. I haven't done anything with it. When I pull the image again it says:
Status: Image is up to date for snipsdocker/platform:latest
I'm kind of inexperienced, so I have no clue as to what is happening.
Could someone help?
PS: I'm using docker on a RaspberryPi Zero
Note: This answer is applicable if you use Windows.
Background
One of the reasons that you have this issue is that the line endings in the files were converted at some point from Unix format (LF) to Windows format (CR LF).
If such conversion happens to .sh file that will be running inside Docker container, Linux will not recognize Windows format of end of line (EOL) and will treat the whole file as a single line. It will lead to an error like standard_init_linux.go:XXX: exec user process caused "no such file or directory"
Cause
The EOL conversion could happen because one of the following:
your local Git is configured to automatically convert line endings to Windows format (autocrlf = true) when you git pull sources
you saved one of the files in some editor in Windows, so it was saved with CR LF line endings
Solution
As a quick fix you can open the file in Notepad++, go to menu Edit/EOL Conversion/Unix, and then save the file
Another quick fix: use CLI tool dos2unix to convert files from command line
Change git configuration by turning off automatic conversion to Windows EOL format:
git config --global core.autocrlf input
It will change the setting globally, for all repositories on your machine.
You can also set it per repository.
See https://help.github.com/articles/dealing-with-line-endings/ for more details.
I am able to do use the ImageMagick convert function on the command line with no problems:
/usr/local/magick/bin/convert a.pdf b.png
I then put it in a one-line PHP file named testconvert.php:
system("/usr/local/magick/bin/convert a.pdf b.png", $code);
and it works fine as a command line call from PHP:
php testconvert.php
But, when I run the script from my browser on localhost:
http://localhost/~me/testconvert.php
I get the error:
convert: no images defined `b.png' # error/convert.c/ConvertImageCommand/3253
I found a lot of folks who have encountered similar problems and fixes ranged from using the absolute path for the files (didn't help) to installing ghostscript (didn't help, either). I'm going a bit gaga with this. Would anyone have any thoughts about what I can possibly try?
Thanks!
Change your system() line to:
system("pwd");
and you will see which directory your script is running in.
I just downloaded ImageMagick but am not sure if it's working. I typed in 'which convert' into my terminal and nothing happened. I also tried typing in 'convert logo: logo.gif' then 'identify logo.gif' and lastly 'display logo.gif' and nothing seemed to happen (these three commands were specified on Windows).
Then I tried following this video: http://www.youtube.com/watch?v=gEWAVlNCKhg
However, it still didn't work and on the last step of the video. I got the following error: ERROR: While executing gem ... (OptionParser::InvalidOption) invalid option: ----with-opt-include=C:/ImageMagick/SourceCode
Can anyone advise on how to correctly install imagemagick on windows or what these errors mean?
That video has a bunch of unnecessary stuff if all you want to do is get ImageMagick working as a standalone product on Windows. All you need to do is:
Download latest Windows binary from imagemagick.org. Right now, that file is located here.
Run the installer (leave all default values the way they are)
Open a command prompt (Start --> Run --> cmd.exe)
Navigate to the ImageMagick folder in the command prompt window. For the default install path, this is done as follows :
Change to the root directory of the C: drive (type cd\ followed by the enter key)
Change to the ImageMagick folder (type cd "Program Files\ImageMagick-6.8.6-Q16" followed by the enter key)
Test that it's working with the convert command: convert images\logo.jpg logo.gif
Look at the directory listing and check the for a logo.gif file with the current time/datestamp (dir logo.gif, followed by enter key).
Note: when you run the convert command, there will not be any output to the command prompt unless you turn on the verbose flag e.g. (convert -verbose images\logo.jpg logo.gif)
I noticed that in my installation that there was not a 'display.exe', but there was an 'imdisplay.exe". I tried using imdisplay in a folder that had images, and it did not how a window. I double clicked imdisplay.exe in the installation folder, and windows came up, including all of the ones I tried to open on the command line. When I closed all of those windows and tried the command line again, it worked.
I am not sure where you are getting 'which convert' (I did not watch the video). I can see all of the exe files that are available in the installation folder. convert.exe is one of them, so in a regular cmd window (I do not know anything about Powershell GitShell), you can just type:
convert logo.png logo.jpg
or something like that.
Following the Railscast episode on CarrierWave:
I installed ImageMagick on Mountain Lion via homebrew, exported the following path:
export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig:$PKG_CONFIG_PATH"
Symlinked the following:
ln -s /usr/local/include/ImageMagick/wand /usr/local/include/wand
ln -s /usr/local/include/ImageMagick/magick /usr/local/include/magick
And installed rmagick via bundler.
In my uploader I have the following:
include CarrierWave::RMagick
version :thumb do
process :resize_to_limit => [85, 85]
end
Which creates thumbnails just fine, but not for png files. I've tried a handful of png images and it always fails with this error:
Failed to manipulate with rmagick, maybe it is not an image? Original Error: no decode delegate for this image format `<path>/public/uploads/tmp/20121022-2133-9885-3333/thumb_cat_vs_internet.png' # error/constitute.c/ReadImage/544
jpeg images work just fine.
EDIT
identify -list format | grep -i png returns nothing, indicating the png decode delegate is probably missing. Now what?
After determining the PNG delegate is not installed (using identify -list format), you should try uninstall/reinstalling ImageMagick as something was likely missed by the installer.