I'd like to compile imagemagick on heroku and allow webp support. I can build and install webp from source, but I can't write it to /usr/local/.. because herokus filesystem is readonly.
I've built webp and installed it to /tmp/webp.
After downloading the imagemagick tarball, I try to compile it with webp support but it can't find the webp installation (understandably so).
Can I run configure with an argument that will allow it to find my webp installation?
Thanks!
Related
I want to build a Markdown to PDF converter running on Heroku using Pandoc and LaTeX that I can send markdown to and it will return a PDF. On my local machine this worked fine without any problem. I am using Pandoc 2.7.3 and pdfTeX 3.14159265-2.6-1.40.20 (TeX Live 2019).
Now I wanted to host this on heroku, but I just get errors for missing files when I run the pandoc command because the versions are old or don't match.
What is the easiest way to get this to run?
Heroku obviously has some limitations on the slug size (500mb), so a full tex install is not possible. It would need to be a smaller subset.
There are Buildpacks for pandoc and TeX Live, but espacially the TeX Live buildpacks seem to be outdated and is not compatible with the pandoc one if you try to run the latest version. The Apt package seems also to maintain only an older version. Is a docker image maybe the answer? https://devcenter.heroku.com/articles/container-registry-and-runtime
I am not necessarily searching for installation instructions, but rather in which way you would handle that. I am a web developer, not a dev ops, so i am really lost in this LaTeX install mess.
I have 16-bit data that I want to save to compressed TIFF file using libtiff. I thought it would install the package with (ana)conda and be done with it, but to no avail.
Miniconda finds, downloads and seems to install libtiff 4.0.9, but when trying to import the package it fails to find it.
Using pip (pip install libtiff) I get pylibtiff 0.4.2 installed as well, but when trying to use this to import libtiff I get the following:
Traceback (most recent call last):
File "", line 1, in
File "C:\Prog\Miniconda3\lib\site-packages\libtiff__init__.py", line 20, in
from .libtiff_ctypes import libtiff, TIFF, TIFF3D
File "C:\Prog\Miniconda3\lib\site-packages\libtiff\libtiff_ctypes.py", line 46, in
raise ImportError('Failed to find TIFF library. Make sure that libtiff '
ImportError: Failed to find TIFF library. Make sure that libtiff is installed >and its location is listed in PATH|LD_LIBRARY_PATH|..
There are binaries installed to my \pkgs directory in miniconda, but these are apparently not found by my python environment, even when adding the .dll directory (\Miniconda3\pkgs\libtiff-4.0.9-hb8ad9f9_1\Library\bin) to the system path.
How does one fix this? I tried to download Libtiff source code and to build it under Windows (using cmake and Visual Studio -- unsuccessfully, as my C-building skills are very elementary).
Any suggestions?
Firstly, to solve the problem at hand libtiff is not required -- scikit-image is sufficient. To make things less-than-super-obvious, the default skimage.io.imsave() method seems to prefer working through PIL (note that an exception is made for TIFF). Here it gets a bit tricky, as PIL's support for compressed TIFF files is either flaky, or requires libtiff.
By default, the different plugins are tried (starting with the Python
Imaging Library) until a suitable candidate is found. If not given
and fname is a tiff file, the tifffile plugin will be used.
and
"Beginning in version 5.0.0, Pillow requires libtiff to read or write
compressed files. Prior to that release, Pillow had buggy support for
reading Packbits, LZW and JPEG compressed TIFFs without using
libtiff."
Secondly, if you have to use libtiff don't try and mix the conda and pip packages. They seem to have in my case downloaded different and incompatible versions of the package. [The conda package installs the libtiff binaries, but not a python wrapper for it. Hence, importing libtiff (as suggested by some online documentation) does not work even though the libraries are present]
But back to the solution:
Scikit-image, however, comes with an external tool that saves TIFF files (using ZIP or LZMA compression): skimage.external.tifffile.imsave() -- see http://scikit-image.org/docs/dev/api/skimage.external.tifffile.html
In conclusion: armed with scikit-image, you can save losslessly Zip-compressed 16-bit TIFF files using the following command (shown here with medium Zip-algorithm compression):
skimage.external.tifffile.imsave("Compressed.tif", image, compress=5)
Problem: ImageMagick convert is unable to crop image. It looks like it doesn't recognize the image type?
What I've Tried:
I've searched around online and I've seen several similar issues but not mine.
I've attempted their solutions including
Uninstalling and reinstalling ImageMagick via brew.
identify -list format (JPEG, GIF, PNG, TIFF, etc were all there and all had rw permissions)
convert -version (png is is among the built-in delegates)
convert pic1.png pic1-jpg.jpg (this worked fine)
convert pic1-jpg.jpg pic1-jpg.jpg (this worked fine)
convert pic1-jpg.jpg 805X972+34+94 pic1-jpg-crop.jpg (this gave the same error as for png as shown below)
I'm working on Mac OSX El Capitan and everything else in terminal works fine. ImageMagick was already installed.
When I run:
$ convert /Users/Innovate/Desktop/crop/2015-04-26-GinaDate13_487.png 805X972+34+94 /Users/Innovate/Desktop/crop/2015-04-26-GinaDate13_487-cropped.png
I get:
convert: unable to open image `805X972+34+94': No such file or directory # error/blob.c/OpenBlob/2702.
convert: no decode delegate for this image format `' # error/constitute.c/ReadImage/504.
no decode delegate for this image format `' # error/constitute.c/ReadImage/504
In the other posts on this issue, people get
convert no decode delegate for this image format `PNG'
Or similar (except with their image type or filename and image type)
However, mine doesn't say anything about image file type...
I have not tried uninstalling ImageMagick then installing it manually from sources because I'm not very confident at doing that... (this solution was shown: https://stackoverflow.com/a/34633084/5398660 )
Does anyone know what might be going on?
Also, can anyone help me interpret the # error/constitute.c/ReadImage/504 part? I'm looking at the code for constitute.c but I'm not sure if I can get useful information from it to solve my problem (I only know a bit of C)
Thank you!
brew remove imagemagick //to delete current version
brew install imagemagick --build-from-source
fixed it for me on mac
I had the same error on Ubuntu 20.04 and ImageMagick.
Had to reinstalled ImageMagick with all add ons according to this instruction:
#These are the steps required in order to Install ImageMagick with JPG, PNG and TIFF delegates.
sudo apt-get update
#Install Build-Essential in order to configure and make the final Install
sudo apt-get install build-essential
#libjpg62-dev required in order to work with basic JPG files
sudo apt-get install -y libjpeg62-dev
#libtiff-dev is required in order to work with TIFF file format
sudo apt-get install -y libtiff-dev
#Download ImageMagick
wget https://www.imagemagick.org/download/ImageMagick.tar.gz
#Untar Imagemagick
tar xvzf ImageMagick.tar.gz
#Access the working directory
cd ImageMagick/[version_number]
#Configure and make sure to disable the "shared" option
./configure --disable-shared
#Make
sudo make
#Install
sudo make install
#Final Check
sudo make check
Throwing in my two cents as I too have struggled with this problem for the last few days. I had no problem running ImageMagick commands on my local machine, but got the error message as mentioned by OP when I ran the command from a Tomcat server running on Azure Cloud.
I could identify the cause by running the following command:
convert -list format
On my local machine, it would return quite a long list of all the supported formats, whereas on Kudu (Azure CLI tool) it would return an empty result. This indicates ImageMagick didn't find the path to its DLL files required for processing.
In my case, the problem was simply caused by a lack of configuration on Azure:
The absence of the ImageMagick root folder in the system environment variable %PATH%
The absence of an environment variable "MAGICK_HOME" (set to the root folder of your ImageMagick installation directory)
The absence of an environment variable "MAGICK_CODER_MODULE_PATH" (set to the folder mentioned above + /modules/coders)
NOTE: for people who are also experiencing this problem on Azure, you can have a look at this SO answer which explains how to add an environment variable using an XDT Transform.
Alright, with playing around I figured out the solution and I'm posting it here for other people who might run into this issue:
Apparently, this is not/no longer is/not for me the way to crop an image using ImageMagick convert. Even though this usage is shown here it did not work for me using El Capitan (maybe it's the OS?).
Instead of using
convert img.png 805X972+34+94 img-crop.png
The correct command, which works is:
convert image.png -crop 805X972+34+94 image-crop.png
That is, the command goes:
convert image.ext -crop heightXwidth+positionX+positionY* imagecropped.ext
More can be found here.
From the description on that ImageMagick page I was confused about the example where they have convert rose: -crop but you can just use it the way I mentioned above and it works fine.
Install ImageMagick with JPG, PNG and TIFF Delegates - Ubuntu (20.04)
Approach 1
Chances are, ImageMagick is already installed on your computer if you are using some flavor of Linux, and its likely not installed if you are using some form of Windows. In either case, you can type the following to find out:
Clone the source repository:
git clone https://github.com/ImageMagick/ImageMagick.git ImageMagick-7.1.0
Next configure and compile ImageMagick. Note the pkg-config script is required so that ImageMagick can find certain optional delegate libraries on your system. To configure, type:
cd ImageMagick-7.1.0
./configure
make
If build fails, try gmake instead. For advanced users, we recommend a modules build:
./configure --with-modules
If ImageMagick configured and compiled without complaint, you are ready to install it on your system. Administrator privileges are required to install. To install, type
sudo make install
You may need to configure the dynamic linker run-time bindings:
sudo ldconfig /usr/local/lib
Finally, verify the ImageMagick install worked properly, type
/usr/local/bin/convert logo: logo.gif
For a more comprehensive test, run the ImageMagick validation suite. Ghostscript and Freetype are prerequisites, otherwise expect the EPS, PS, PDF and text annotations tests to fail.
make check
Approach 2
Follow the below link
Install ImageMagick with JPG, PNG and TIFF Delegates - Ubuntu (20.04)
I was receiving the same error for missing some single quotes.
When combining images with convert -draw with quotes, the image supplied must be wrapped in quotes.
No decode delegate for this image format `' # error/constitute.c/ReadImage/504
convert myBackground.png -font Arial -pointsize 20 \
-draw "gravity west image Over 50,80,20,20 'myForeground.png'" \
# -----------------------------------------^ added missing single quotes
-flatten ./finalImage.jpg
When I added in the single quotes around myForeground the issue disappeared. What a lousy error!
I also had to fight this problem today in a convert operation that applied a different color space profile.
It seems imagick's convert command is sensitive to the file extension of the profile's file name. In my case it was a temporary file without a suffix that triggered the same error message from the question title
convert infile.jpg -profile /tmp/profile-without-suffix outfile.jpg
Adding the correct suffix to the profile file name fixes the problem:
(assuming ICC format)
convert infile.jpg -profile /tmp/profile-without-suffix.icc outfile.jpg
For me (on macos Mojave, using Imagick with CraftCMS) I had to reinstall Imagick with pecl uninstall imagick and pecl install imagick (and then restart Apache with sudo apachectl -k restart). I must have run brew upgrade and got a newer version of ImageMagick which caused Imagick to barf up a similar error of NoDecodeDelegateForThisImageFormat 'JPEG' # error/constitute.c/ReadImage/556.
An alternate Imagemagick command would be:
convert pic1-jpg.jpg[805x972+34+94] pic1-jpg-crop.jpg
or as stated earlier
convert pic1-jpg.jpg -crop 805x972+34+94 +repage pic1-jpg-crop.jpg
see Inline Image Crop at https://www.imagemagick.org/script/command-line-processing.php
Generally, I prefer the use of x (lower case) rather than X (uppercase) between the width and height, for easier reading. But either works.
I used a suitable docker image, for example:
docker run -v /path/to/picsdir/:/pics --rm dpokidov/imagemagick /pics/img.heic /pics/img.png
This helped me convert from HEIC to PNG.
To load image, I installed the CImg library in my mac(OSX 10.10). Luckily I managed to display the bmp picture, but I failed to load and display other formats like png or jpg.
Then I installed the ImageMagic which is downloaded from http://cactuslab.com/imagemagick/ and then run the program. The errors are still there.
My code is :
#include "CImg.h"
#include <stdlib.h>
#define cimg_use_magick
using namespace cimg_library;
int main() {
CImg<unsigned char> image("lena.jpg");
image.display();
return 0;
}
The program can be built successfully in my Xcode but it reported the error that is "failed to recognize the format"
I just don't know how to fix it. thanks for your help!
I am guessing your ImageMagick installation does not have the necessary libraries for reading JPEG files. ImageMagick refers to the handlers for the various image formats as DELEGATES, so try this command to see what formats your ImageMagick installation can cope with:
identify -list configure | grep DELEGATES
DELEGATES bzlib mpeg freetype jng jpeg lzma png tiff xml zlib
Personally, I never had any success with the CactusLabs installation. I use homebrew. You copy the one-liner installation script from here, and then you can simply manage all packages on your Mac with the brew command. For example, to find the name of the ImageMagick package, just do
brew search imagemagick
To install ImageMagick, run
brew install imagemagick
To uninstall ImageMagick, run
brew rm imagemagick
To install Cimg, run
brew install cimg
To find ffmpeg, or GNU Parallel, just do
brew search ffmpeg
brew search parallel
To sort out any problems with homebrew, just call the Doctor:
brew doctor
and it will tell you about any problems or inconsistencies.
Trying to give RMagick a whirl, using Mac OSX and homebrew.
Versions:
Mac OSX 10.7.5, HomeBrew 0.9.4., Ruby 2.0, Rmagick 2.13.2, ImageMagick 6.8.6-3.
Here is my Ruby code, in a file named rename.rb:
require 'RMagick'
include Magick
cat = ImageList.new("test.jpg")
cat.display
exit
and here is my terminal output:
rename.rb:5:in `display': delegate library support not built-in `test.jpg' (X11) # error/display.c/DisplayImages/16067 (Magick::ImageMagickError)
from rename.rb:5:in `<main>'
It seems though I have the proper delegates installed (I'm not entirely sure, however, since I'm a n00b at ImageMagick). If I run convert -list configure, I get this:
...
DELEGATES bzlib fontconfig freetype jng jpeg png rsvg tiff xml zlib
...
any ideas? Thanks!
The image has been read and processed successfully, your error is being thrown by cat.display It is not an image format delegate missing, but a window display one.
You will see the same error message on the command line if you simply type:
display test.jpg
So this is an Image Magick issue, not an RMagick or Ruby one.
It seems that the display method is designed to work with X11 windowing, which is not a default feature on Mac OS X. You may be able to re-build it including an X11 service and libary. I use XQuartz for X11 support, but installing it after Image Magick (as I did) won't fix this issue. So, I get same error as you, but I don't use display, I just use a command like open test.jpg on the command line, or:
`open test.jpg`
from Ruby. This is not a platform-agnostic solution, but I can view the images I process just fine.
Alternatively, you could try re-installing Image Magick and rmagick with X11 support (provided of course that you have an X11 service installed such as XQuartz):
brew unlink imagemagick
brew install imagemagick --with-x11
gem install rmagick
I have tested this, and it works to so that cat.display will launch a display window. Although I think I will continue to use other viewers myself.