Page 1 of 1

Error converting png with -background #ff0000 option

Posted: 2015-11-21T19:34:07-07:00
by nycionx
I just installed the latest version of ImageMagick-6.9.2-6 from source on Linux Mint 17.2 x64 in a separate location btw (/home/im/).

I'm getting an error running this command with convert:

./convert sample.png -background #ff0000 sample1.png

convert: missing an image filename `-background' @ error/convert.c/ConvertImageCommand/3243.

what seems to be the problem here?

here's all the details:

nycionx@nycionx-VirtualBox /home/im/bin $ ./convert -list configure

Path: /home/im/lib/ImageMagick-6.9.2//config-Q16/configure.xml

Name Value
-------------------------------------------------------------------------------
CC gcc -std=gnu99 -std=gnu99
CFLAGS -I/usr/include/libpng12 -I/usr/include/freetype2 -I/usr/include/freetype2 -fopenmp -g -O2 -Wall -mtune=core-avx-i -fexceptions -pthread -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
CODER_PATH /home/im/lib/ImageMagick-6.9.2/modules-Q16/coders
CONFIGURE ./configure '--prefix=/home/im' '--exec-prefix=/home/im' '--datadir=/home/im' '--with-gslib=yes'
CONFIGURE_PATH /home/im/etc/ImageMagick-6/
COPYRIGHT Copyright (C) 1999-2015 ImageMagick Studio LLC
CPPFLAGS -I/home/im/include/ImageMagick-6
CXX g++
CXXFLAGS -g -O2 -pthread
DEFS -DHAVE_CONFIG_H
DELEGATES mpeg fontconfig freetype gslib jbig jng jpeg lzma png ps tiff zlib
DISTCHECK_CONFIG_FLAGS --disable-deprecated --with-quantum-depth=16 --with-jemalloc=no --with-umem=no --with-autotrace=no --with-fontpath= --with-rsvg=no --with-perl=no
DOCUMENTATION_PATH /home/im/doc/ImageMagick-6
EXEC-PREFIX /home/im
EXECUTABLE_PATH /home/im/bin
FEATURES DPC Cipher OpenMP
FILTER_PATH /home/im/lib/ImageMagick-6.9.2/modules-Q16/filters
GIT_REVISION 10342
HOST x86_64-unknown-linux-gnu
INCLUDE_PATH /home/im/include/ImageMagick-6
LDFLAGS -L/home/im/lib
LIB_VERSION 0x692
LIB_VERSION_NUMBER 6,9,2,6
LIBRARY_PATH /home/im/lib/ImageMagick-6.9.2
LIBS -ljbig -ltiff -lfreetype -ljpeg -lgs -lpng12 -lfontconfig -lfreetype -llzma -lz -lm -lgomp
NAME ImageMagick
PCFLAGS -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
PREFIX /home/im
QuantumDepth 16
RELEASE_DATE 2015-11-22
SHARE_PATH /home/im/ImageMagick-6
SHAREARCH_PATH /home/im/lib/ImageMagick-6.9.2/config-Q16
TARGET_CPU x86_64
TARGET_OS linux-gnu
TARGET_VENDOR unknown
VERSION 6.9.2
WEBSITE http://www.imagemagick.org

Path: [built-in]

Name Value
-------------------------------------------------------------------------------
FEATURES OpenMP
NAME ImageMagick
QuantumDepth 16

Re: Error converting png with -background #ff0000 option

Posted: 2015-11-21T19:51:40-07:00
by nycionx
nvm i just figured it out!

the hex color needed to be in quotes! single or double doesnt matter but it worked! omg ive wasted 2 hrs trying to figure out the damn problem! :))

so just this worked:

./convert sample.png -background "#ff0000" sample1.png
OR
./convert sample.png -background '#ff0000' sample1.png

yay! :)

Re: Error converting png with -background #ff0000 option

Posted: 2015-11-21T20:03:00-07:00
by snibgo
Yes, hash # is a special character in bash, and needs to be quoted or escaped.