ImageMagick no encode delegate - imagemagick

I used to be able to convert text to an image using ImageMagick but now I get this error message:
$ echo text | convert -background none text:- file
convert: no encode delegate for this image format `TEXT' # error/constitute.c/WriteImage/1167.
ImageMagick was installed using Homebrew
imagemagick: stable 7.0.7-10 (bottled), HEAD
Tools and libraries to manipulate images in many formats
https://www.imagemagick.org/
/usr/local/Cellar/imagemagick/7.0.7-10 (1,523 files, 23.1MB) *
Poured from bottle on 2017-11-10 at 15:46:33
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/imagemagick.rb

In IM 7, convert is replaced by magick. You also have not specified an output image format for "file". Try this:
echo "text" | magick -background none text:- file.png
or
echo "text" | magick -background none text:- PNG32:file
That works for me on IM 7.0.7.10 Q16 Mac OSX
What do you get from
magick -version
Does it include freetype?
If not, then you probably need to install Freetype with ImageMagick via Homebrew

Related

Animation is lost after converting png to webp

I have an animated PNG image but after I convert it to webP - I get the static image without animation.
I've tried cwebp
$ cwebp -q 100 1.png -o 1.webp
$ cwebp -version
1.0.0
and the same with imagemagick
$ magick 1.png -quality 100 -define webp:lossless=true 1.webp
$ magick --version
Version: ImageMagick 7.0.10-29 Q16 x64 2020-09-05 http://www.imagemagick.org
How can I convert to save the animation?
As discovered, cwebp does not support conversion with animation. Possible solution is to extract the individual frames (using ffmpeg or imagemagick for instance) and use img2webp to generate the animation.

How do I use the input filename in ImageMagick?

According to the ImageMagick documentation, I would expect this:
convert fountain-pen1.jpg fountain-pen2.jpg handwriting.jpg -resize 400x400\> -set filename:f '%t_smol.%e' '%[filename:f]'
to result in fountain-pen1_smol.jpg fountain-pen2_smol.jpg handwriting_smol.jpg.
Instead, it only creates fountain-pen1_smol.jpg.
What am I doing wrong here?
I've also tried with just *.jpg which results in the same output.
convert -version
Version: ImageMagick 6.9.7-4 Q16 arm 20170114 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib
Mmm... sometimes you need to give ImageMagick a hint to create more output files than it is expecting to, using +adjoin:
convert fountain-pen1.jpg fountain-pen2.jpg handwriting.jpg -resize 400x400\> -set filename:f '%t_smol.%e' +adjoin '%[filename:f]'
It guesses this if you put a %02d or somesuch in the filename, but doesn't know that for your use case.
With ImageMagick you'll generally need to set that "filename:" variable right after reading in the images. Try this...
convert img1.jpg img2.jpg img3.jpg \
-set filename:f "%[t]_smol.%[e]" -resize 400x400\> "%[filename:f]"
That reads in the images, sets those output filenames right away, then performs the resizing operation, then writes the output files with the given names. Be aware that changing the order of the list or the number of images within the command can create unexpected results.
I've used this command successfully with IM 6.8.9 in bash. It works with 6.9 and 7.0 versions in Windows by changing the continued-line backslashes "\" to carets "^", and deleting the backslash and putting the resize "400x400>" inside double quotes.

Paperclip, ImageMagick "UnrecognizedAlphaChannelType `remove'"

I am running a project with these software versions:
Paperclip 4.2.0
Rails 4.0.4
RHEL 6
convert -version => ImageMagick 6.8.9-9
convert -list configure =>
DELEGATES bzlib mpeg freetype jng jpeg lcms png ps tiff x zlib
and am getting this error while processing images through Paperclip.
Command :: convert '/tmp/a583e7c175d537c0442da246e5184fe120141205-17371-tvp3g.jpg' -auto-orient -resize "x85" -crop "85x85+21+0" +repage -alpha remove -strip '/tmp/a583e7c175d537c0442da246e5184fe120141205-17371-tvp3g20141205-17371-1ym7alo.png'
convert: UnrecognizedAlphaChannelType `remove' # convert.c/ConvertImageCommand/636.
Cocaine::ExitStatusError: Command 'convert '/tmp/a583e7c175d537c0442da246e5184fe120141205-17371-tvp3g.jpg' -auto-orient -resize "x85" -crop "85x85+21+0" +repage -alpha remove -strip '/tmp/a583e7c175d537c0442da246e5184fe120141205-17371-tvp3g20141205-17371-1ym7alo.png'' returned 1. Expected 0
Here is the command output:
from /home/proj/.rvm/gems/ruby-2.1.1/gems/cocaine-0.5.4/lib/cocaine/command_line.rb:96:in `run'
This error is caught on the Thumbnail processor in the make method.
The most confusing part of this is that I set a debugger when this error is caught, copied the src tmpfile to a permanent location outside my project and ran the exact same convert command as above and it runs successfully with exit status 0.
My next step in debugging would probably to bundle open cocaine, but I think there is something higher level going wrong... Hoping someone has run into this before?
I don't get the same problem on OSX.
You may have multiple installations of ImageMagick installed. You can check at the command line like so:
$ which -a convert
If you do have multiple installations, and Paperclip is referencing the "wrong" one, Paperclip allows you to specify the path to seek. As from the Paperclip README:
In development mode, you might add this line to config/environments/development.rb:
Paperclip.options[:command_path] = "/usr/local/bin/"

.CDR to .SVG Convert Using ImageMagick

I am on CentOS 6.4 and trying to convert .CDR to .SVG Convert Using ImageMagick using SSH command.
my 1.cdr file is in /var/www/vhosts/website.com/httpdocs/test/1.cdr
once converted to SVG it should be created in the same folder
Tried the following command:
convert /var/www/vhosts/website.com/httpdocs/test/1.cdr image.svg
The Error I am getting is:
sh: mplayer: command not found convert: Delegate failed "mplayer"
"%i" -really-quiet -ao null -vo png:z=3' #
delegate.c/InvokeDelegate/1032. convert: missing an image filename
image.svg' # convert.c/ConvertImageCommand/2800.
Not sure what does that mean ?
In order to convert CDR files you need to install uniconvertor for CDR delegate.
List of all delegates:
convert -list delegate
By default it outputs:
cdr => "uniconvertor" "%i" "%o.svg"; mv "%o.svg" "%o"
Install uniconvertor. For example, on Ubuntu it’s:
sudo apt-get install python-uniconvertor
Then run:
convert image.cdr -flatten -thumbnail '512x512' image.png
Or, with zoom cropping:
convert image.cdr -flatten -thumbnail '512x512^' -gravity center -crop 512x512+0+0 +repage image.png
And you’re done.
I convert to PNG here but you may use your own output format.
python-uniconvertor is part of inkscape.
It does not exist by itself.
Ubuntu/Mint recently removed all the old Python stuff, for Corel Draw I have to fire up the WinXP VM & Corel and export something Linux understands, usually PNG, a favourite
CDR & WMF files are pretty much dead to Linux, ImageMagick can still handle WMF though.

Can't install GhostScript in ImageMagick

Download latest version of ImageMagick. Unpacked it. Installing Ghostscript like this:
$ sudo apt-get install ghostscript
After that try to configure ImageMagick:
$ ./configure --with-gslib
$ make
$ make install
After that i try to conver PDF to jpg
$ sudo /usr/local/bin/convert in.pdf out.jpg
And i see this mistake
convert: no decode delegate for this image format `/tmp/magick-BzHdr4Kp-00000001' # error/constitute.c/ReadImage/544.
convert: Postscript delegate failed `in.PDF': Нет такого файла или каталога # error/pdf.c/ReadPDFImage/678.
convert: no images defined `out.jpg' # error/convert.c/ConvertImageCommand/3044.
What i'm doing wrong?
Try the following convert commands to see more precisely what's possibly going wrong:
convert a.pdf -debug coder a.jpg
convert a.pdf -debug all a.jpg
There will possibly be a lot of output going to stderr. Amongst the lines you may see where IM is looking for Ghostscript. Also, try
convert -list delegate
convert -list delegate | grep --color -E '(eps|pdf)'
to find with which exact commandlines ImageMagick tries to run Ghostscript (it may call gsx instead of gs, or it may look for it in /usr/local/bin/...). If you find any deviations from your real Ghostscript installation, you can possibly fix it by editing delegates.xml.
convert -list configure
will show you how ImageMagick is configured (and if, for example, gs was during compile-time in the list in DELEGATES variables). Here you also find where to look for delegates.xml:
convert -list configure | grep CONFIGURE_PATH
should list the directory where this (as well as some more) *.xml settings files are located which control how convert et al. behave...

Resources