Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
I'm running this as a php exec. The code does work but it pixelates the whole image and not just part of it as illustrated in the example. I even used the same code as the example in two different servers (the second one had the latest version of IM installed). Not sure if this is a feature that is no longer working, or if it's not working just for me for some reason, but I'd greatly appreciate some insight or help:
Here is my code (same as in the example, but php on a webserver instead of the command line):
You probably need to include semi-colons between the commands in PHP.
It is also possible to do all the actions in a single command, probably with parenthesis. See Im examples basics. which will remove the need for intermediate images.
The only reason I break it into multiple commands in IM examples is to make the steps simpler and allow me to display those intermediate images.
I used the longer version for illustration purposes, but I also have tried the shorter version that uses only one convert. I don't believe semicolons are needed in the example I provided in this thread with PHP since I'm using the exec command which does end in a semicolon.
The exec command is used to execute code from an external program (IM in this case), so ideally this should have worked. Instead I'm getting a 100% pixelated image. I'm not 100% sure though since I have little experience with IM. Anything else you think I should try?
Thanks for the great code and examples by the way!
The next thing is where you are writing the images. Often the PHP code in a web server runs as a special user with little to no privileges.
Now you get one image, but that may have been to an existing file, or maybe even that file is not being updated and you just see the same file over and over. Check the file and directory permissions. check the dates on the file after a run. Remove the previous results after every run.
Later you will need to remember that code in a web server could be run by more than one client at the same time. Each run must use a different set of temporary files or you will get problems as the number of users start to cause simultaneous runs.
I checked my file permissions actually and the file access is set to 777 recursively for that directory, so I'm guessing it's not an access permissions issue.
I also set up the error log but nothing there either. Also, checked and the images are fresh every time. The mask image is being created and I can see that it's a transparent gif, but it's strange that the final image is still 100% pixelated.
Any other suggestions at this point? Thanks again for all your insight and help!
I was able to get this info about the current ImageMagick installed in my shared Media Temple web hosting account:
convert is /usr/bin/convert
locate: /var/cache/locate/locatedb: No such file or directory
Version: ImageMagick 6.2.4 09/16/06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2005 ImageMagick Studio LLC
I finally got this to work, but only on another webserver. It never worked on the MediaTemple shared web hosting account I have, but it worked in another shared web hosting account with HostGator.com.
I suspect it may have to do with the ImageMagick version installed in MediaTemple or some other setting. In MediaTemple no matter what, it always pixelated the final image to 100%.
Bonzo thanks for your code, however I can get this to work with multiple converts the way I initially had the code, but I do see the benefit of separated the converts.
Thanks again to both Anthony and Bonzo for your input. I still would be interested if you may know why this did not work on the other server.
When I tried all 3 converts on one line I was just getting the black mask with the white circle as the final image although it was not created when I tried to view it as zelda_face_mask.gif!