Installing Image Magick with Ghostscript - linux

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.

Related

Cygwin Gcc error while loading shared libraries?

I have instaled Cygwin after running MinGW for a while now. But when I try to compile the console gives me:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/cc1.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory
What does this mean?
I have the same problem and I found the solution.
According to the FAQ of Cygwin
Q: Why is C:\cygwin\usr\bin invisible from windows?
A: Because it does not really exist. In cygwin, /usr/bin is just a link to /bin.
So trying to add "C:\cygwin\usr\bin" to PATH will be in vain.
Add "C:\cygwin64\bin" to PATH instead. Hope this helps :)
You are missing a library, please run cygcheck /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/cc1.exe or ldd /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/cc1.exe to see what is the missing library.
(I'd rather ask a question in the comments first, but I don't have enough reputation yet.)
Your cc1 is unable to load some DLLs it needs to start. Looking at the Cygwin source code, this can be either a library specified in LD_PRELOAD, or -- more probably -- a library the executable depends on. The ? in the error message seems to be the default return value of find_first_notloaded_dll (hookapi.cc), in case the function can't determine what library is missing.
To diagnose the issue, I suggest checking your PATH variable (or even clearing it of any non-Cygwin paths and trying the compilation again) and/or using Dependency Walker to find the missing DLLs (start it from a Cygwin shell, so it can see the same PATH). ldd (included with Cygwin) may also give some clues, but I wouldn't bet on it.
It's possible a clean re-install of Cygwin will be necessary to solve the issue.
Most likely, you are simply missing /usr/bin in the PATH variable.
Adding 'export PATH=/usr/bin:$PATH' to your .bashrc file will solve the issue.
Adding some background info. I had the same problem when building my own program and linking it against graphviz cgraph.dll. Turns out this is related to where windows searches for DLLs (see here: https://msdn.microsoft.com/en-us/library/7d83bc18.aspx) So adding the path of your missing library to PATH should fix the problem.
It is unfortunate that the message doesn't include the name of the library. Luckily cmd.exe DOES give you this name (so it's good for something after all;)
Are you including the path to your lib directory?
Looks like you are not
I'm not very familiar with Cygwin, I mainly use MinGW, but I think the error message speaks for itself
I also came this error on windows machine while executing .exe file generated by scilab2C i.e toolbox for Scilab
For Windows 32 bit Add the environment variable path as follow :
C:\cygwin\usr\i686-pc-cygwin\bin
Hope so this will solve your issue.
Just had this problem trying to compile a package with make and it wanted some cygguile dll file that was just installed along with make.
My solution was I had not only migrated my cygwin64 directory across drives because the sector sizes were mismatched for some reason even though the drivers were both under 2TB and should have been using 512 byte sector sizes.. So I had to install a new system and move files over there, might have had weird permissions on them.
Also had to patch cygwin1.dll end of Jan 2020 because of a recent input problem in ConEmu with Windows 10 1903 build, but just did it again with this working so that doesn't seem to be the issue.
Reinstalling cygwin by deleting that entire directory, taking ownership of it first.., seemed to work now...

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.

Node.js ImageMagick & GM both cause error 127 when trying to load a valid image

I have a node app which accepts an uploaded image (using formidable) and stores it into an Amazon S3 bucket. Before it is saved to S3, I want to get the image's width, height, etc. for future consideration. I found this question which helped: Opening images on NodeJS and finding out width/height
However, when I try to open the image with imagemagick (or gm, for that matter, I've tried both) I get error 127. Specifically, imagemagick reports:
{"timedOut":false,"killed":false,"code":127,"signal":null}
I know the file exists (because it is properly uploaded to the S3 bucket), and I can manipulate it (eg, rename) via fs, but I cannot find any documentation on error code 127 to determine why IM fails. Thinking that perhaps there was something odd about the file uploaded to formidable causing it to not be read properly, I tried using imagemagick to load a simple "test.jpg" image in the same folder:
im.identify('test.jpg', function(err, features){
if(!err)
{
// my image processing code
}
else
{
// my err handling code; spits out the error above
}
});
Unfortunately, this fails in the exact same manner, even though I'm sure test.jpg is a good and properly formatted image.
So, can anybody help me understand what error 127 is and why ImageMagick would throw it when fs is able to read the file just fine...?
These are a couple of php commands to find the path to Imagemagick which should confirm it is installed.
Sometimes in php there is a problem just using convert and you need to use the full path; something like /usr/local/bin/convert
echo "<pre>";
system("type convert");
system('which convert',$path); print_r($path);
echo "</pre>";
I know you are not using php but you should still be able to use the methods.
Make sure "convert" is installed
sudo apt-get update
sudo apt-get install imagemagick --fix-missing
Derp. I didn't have ImageMagick itself installed. I assumed that the NPM installation was all that was required; did not realize there were additional dependencies, and the error message was a bit cryptic ;)
I had the same problem, just install Graphics Magick, http://www.graphicsmagick.org/
test if your intallation works as the wizard suggest and that's it.

How to install something on Linux without Makefile (lessc in this case)

I am relatively new to the Linux world so forgive this question if it is simple. I have cloned the lessc repo from this url: https://github.com/cloudhead/less.js
However I cannot find a way of installing it. Am I missing something or is there a manual way to install things setup like this. I have encountered this problem several times and would appreciate any input you could offer. Thanks!
You don't have to install lessc with make install.
It is not a binary program, it's a javascript, so you jut have to copy in the correct position of your website.
Unlike programs, which have a specified position where they have to be installed, files that have to be served by webserver do not have an install script, because there's not fixed position in the filesystem where a website is stored.

How to set up MIT Scheme for 6.001 in Ubuntu 8.10

I play to self-study 6.001 with the video lectures and lecture handouts. However, I have some problems setting up MIT Scheme in Ubuntu (intrepid).
I used package management and installed MIT-Scheme, but it's obviously the wrong version to use. It should be 7.5.1 instead of 7.7.90
I followed the instructions from this website (http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-001Spring-2005/Tools/detail/linuxinstall.htm)
So far, I've downloaded the tar file, and extracted to /usr/local. I have no idea what step 3 means.
Then I entered command
scheme -large -band 6001.com -edit
and the error is
Not enough memory for this configuration.
I tried to run under sudo mode, and this time the error is different
Unable to allocate process table.
Inconsistency detected
I have close to 1GB of free memory, with ample HDD space. What should I do to successfully set this up?
Step 3 means that you should type export MITSCHEME_6001_DIRECTORY=${your_problems_path}. If you don't want to type it every time you launch Scheme, you should put it as a string in your ~/.bash_profile file(in case you use bash)
About the problem itself, Google instantly suggests a solution:
sudo sysctl -w vm.mmap_min_addr=0(taken from http://ubuntuforums.org/showthread.php?p=4868292)
Instead of the package manager, you may also want to compile the portable C sources for Unix. I am using it happily.

Resources