Syntax problems or installed wrong.

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?".
Post Reply
wappy
Posts: 9
Joined: 2013-11-09T18:27:19-07:00
Authentication code: 6789

Syntax problems or installed wrong.

Post by wappy »

I appear to be having problem with the proper syntax and I wanted to see if anyone could see what i am doing wrong.

If I use this command it outputs images:
convert rose: rose_bg_mask.png

If I use this command it does not work, it appears the backslach is causing problems but i copied it from the example at
"http://www.imagemagick.org/Usage/masking/". Does anyone see a problem with what i am doing wrong?

brad@ubuntu:~/Documents$ convert rose: -mask rose_bg_mask.png \ -modulate 110,100,33.3 +mask rose_blue.png
convert: unable to open image ` -modulate': @ error/blob.c/OpenBlob/2587.
convert: no decode delegate for this image format ` -modulate' @ error/constitute.c/ReadImage/532.
convert: unable to open image `110,100,33.3': @ error/blob.c/OpenBlob/2587.
convert: no decode delegate for this image format `110,100,33.3' @ error/constitute.c/ReadImage/532.
brad@ubuntu:~/Documents$



identify --version
Version: ImageMagick 6.6.9-7 2012-08-17 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Syntax problems or installed wrong.

Post by snibgo »

In Unix etc you use a backslash to break a command into more than one line. If you are not breaking the command, don't use a backslash.
snibgo's IM pages: im.snibgo.com
wappy
Posts: 9
Joined: 2013-11-09T18:27:19-07:00
Authentication code: 6789

Re: Syntax problems or installed wrong.

Post by wappy »

Well if i remove the backslash then i get a different error:

brad@ubuntu:~/Documents$ sudo convert rose: -mask rose_bg_mask.png -modulate 110,100,33.3 +mask rose_blue.png
convert: unable to open image `rose_bg_mask.png': @ error/blob.c/OpenBlob/2587.
convert: unable to open file `rose_bg_mask.png' @ error/png.c/ReadPNGImage/3238.
brad@ubuntu:~/Documents$


I thought maybe it was a permissions issues so i used sudo.

Any idea's? heh

Thanks
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Syntax problems or installed wrong.

Post by fmw42 »

Possibly a bug in your IM version. Your version 6.6.9.7 is rather old. The command from http://www.imagemagick.org/Usage/masking/#write_mask works fine for me on IM 6.8.7.5 Q16 Mac OSX

convert rose: -mask rose_bg_mask.png -modulate 110,100,33.3 +mask rose_blue.png

The only other possible issue is that you may not have read/write permission in the directory you are working in.

Is IM configured to work with png files?

Is it listed in convert -list configure, under DELEGATES?
Last edited by fmw42 on 2013-11-09T21:04:36-07:00, edited 1 time in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Syntax problems or installed wrong.

Post by snibgo »

Do you have the file rose_bg_mask.png in your current directory? If not, that's the problem. You can download it from the web page (right-click, etc).
snibgo's IM pages: im.snibgo.com
wappy
Posts: 9
Joined: 2013-11-09T18:27:19-07:00
Authentication code: 6789

Re: Syntax problems or installed wrong.

Post by wappy »

@snibgo, I believe these png files are built into IM for testing basically functionality and examples. Or am I wrong? i don't know

@Fred, thanks for the suggestions, The old version of IM is the one that auto installs using apt-get. I just compiled IM and installed the new version. below are the results.

I just ran the following command:
brad@ubuntu:~/Documents$ convert rose: -mask rose_bg_mask.png -modulate 110,100,33.3 +mask rose_blue.png
convert: unable to open image `rose_bg_mask.png': No such file or directory @ error/blob.c/OpenBlob/2643.
convert: unable to open file `rose_bg_mask.png' @ error/png.c/ReadPNGImage/3995.
brad@ubuntu:~/Documents$

I just checked the permissions for the folder i am running the command in and they look fine to me.
drwxr-xr-x 7 brad brad 4096 Nov 9 19:20 Documents


convert -list configure, under DELEGATES
DELEGATES bzlib djvu mpeg fontconfig freetype jng jp2 jpeg lcms lqr openexr pango png ps tiff x xml zlib


identify --version
Version: ImageMagick 6.8.7-5 Q16 i686 2013-11-08 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib djvu fontconfig freetype jng jp2 jpeg lcms lqr openexr pangocairo png tiff x xml zlib
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Syntax problems or installed wrong.

Post by dlemstra »

wappy wrote:@snibgo, I believe these png files are built into IM for testing basically functionality and examples. Or am I wrong? i don't know
The file rose_bg_mask.png is not a built in file, rose: is.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Syntax problems or installed wrong.

Post by fmw42 »

Images that end with a colon : are built in images. Other images with a suffix are not. See

http://www.imagemagick.org/script/forma ... tin-images
http://www.imagemagick.org/script/formats.php#pseudo
wappy
Posts: 9
Joined: 2013-11-09T18:27:19-07:00
Authentication code: 6789

Re: Syntax problems or installed wrong.

Post by wappy »

Thanks for clarification on which files are built in. So i thought i would try to drill down on a single option.

If i type this command i get an error it does not seem to see the file name which is the argument.
brad@ubuntu:~/Documents$ convert rose: -mask rose_bg_mask.png
convert: option requires an argument `-mask' @ error/convert.c/ConvertImageCommand/2020.
brad@ubuntu:~/Documents$

However if I put a plus (random trying stuff) then the command does see the file however the output is not what i expected it looks identical to the rose: i was expecting a black outline of the rose outline.
brad@ubuntu:~/Documents$ convert rose: +mask rose_bg_mask.png
brad@ubuntu:~/Documents$

If anyone has any suggestions let me know.
Thanks
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Syntax problems or installed wrong.

Post by snibgo »

Code: Select all

convert rose: +mask rose_bg_mask.png
That command:

1. Reads the "rose:" image (which is built in).

2. Turns off the mask feature (which isn't on, so thiat does nothing).

3. Writes the current image to a file named rose_bg_mask.png.

So you should now have a file with that name. It will look exactly like the rose: image.

To get the rose_bg_mask.png used by the web page, download it from the web page.
snibgo's IM pages: im.snibgo.com
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Syntax problems or installed wrong.

Post by snibgo »

I should also point you to the documentation: http://www.imagemagick.org/script/comma ... s.php#mask

"-mask" needs an argument, which is an input filename. The file must already exist. And then you need another filename for the output file.

"+mask" turns off the mask feature, and takes no argument. So the next filename is taken as the output file.
snibgo's IM pages: im.snibgo.com
wappy
Posts: 9
Joined: 2013-11-09T18:27:19-07:00
Authentication code: 6789

Re: Syntax problems or installed wrong.

Post by wappy »

thanks snibgo

I'm still pretty new to ImageMagicK and i guess it is showing hehe.

I tried the command like you instructed and it worked fine.
Post Reply