Convert and draw same command issue

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
hcorreia
Posts: 7
Joined: 2012-04-11T16:57:25-07:00
Authentication code: 8675308

Convert and draw same command issue

Post by hcorreia »

This i my first post and I could not find the answer.
I am using Windows XP to run IM. I have an image that I am trying to put a blank image over a certain area. I have created a blank image 1x1 I go to my directory and run the command below and get the error also below
convert card.png -draw 'image SrcOver 0,65 1000,1000 point.png' cardnew.png
C:\testi[/color]ng>convert card.png -draw 'image SrcOver 0,65 1000,1000 point.png' cardn
ew.png
convert.exe: Non-conforming drawing primitive definition `image' @ error/draw.c/
DrawImage/3146.
convert.exe: unable to open image `SrcOver': No such file or directory @ error/b
lob.c/OpenBlob/2617.
convert.exe: no decode delegate for this image format `SrcOver' @ error/constitu
te.c/ReadImage/533.
convert.exe: unable to open image `0,65': No such file or directory @ error/blob
.c/OpenBlob/2617.
convert.exe: no decode delegate for this image format `0,65' @ error/constitute.
c/ReadImage/533.
convert.exe: unable to open image `1000,1000': No such file or directory @ error
/blob.c/OpenBlob/2617.
convert.exe: no decode delegate for this image format `1000,1000' @ error/consti
tute.c/ReadImage/533.
convert.exe: unable to open image `point.png'': No such file or directory @ erro
r/blob.c/OpenBlob/2617.
convert.exe: no decode delegate for this image format `point.png'' @ error/const
itute.c/ReadImage/533.
convert.exe: Non-conforming drawing primitive definition `image' @ error/draw.c/
DrawImage/3146.[/color]


Can anyone tell me what I am doing wrong?
Thank you
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert and draw same command issue

Post by fmw42 »

See the syntax at http://www.imagemagick.org/Usage/layers/#draw. You need double quotes outside for the draw command and single quotes about your image.

But I am not sure you can draw a transparent image into another image that way. I could be wrong.

For other ways to draw a rectangular "hole" see
http://www.fmwconcepts.com/imagemagick/ ... nsert_hole
http://www.imagemagick.org/Usage/compose/#copy
http://www.imagemagick.org/Usage/compose/#dstout
http://www.imagemagick.org/Usage/draw/#matte
hcorreia
Posts: 7
Joined: 2012-04-11T16:57:25-07:00
Authentication code: 8675308

Re: Convert and draw same command issue

Post by hcorreia »

Thank you so much that did it. Yes this worked it covered the image thank you again

C:\testing>convert card.png -draw "image SrcOver 0,65 1000,1000 'point.png'" car
dnew.png
hcorreia
Posts: 7
Joined: 2012-04-11T16:57:25-07:00
Authentication code: 8675308

Re: Convert and draw same command issue

Post by hcorreia »

Since I have you any idea the command to do this in batches?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert and draw same command issue

Post by fmw42 »

hcorreia wrote:Since I have you any idea the command to do this in batches?

see mogrify
http://www.imagemagick.org/Usage/basics/#mogrify
http://www.imagemagick.org/Usage/basics ... fy_compose
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert and draw same command issue

Post by fmw42 »

hcorreia wrote:Thank you so much that did it. Yes this worked it covered the image thank you again

C:\testing>convert card.png -draw "image SrcOver 0,65 1000,1000 'point.png'" car
dnew.png
That command does not work for me using a fully transparent point.png! Is your point.png transparent?

In fact, there is no src_over listed at http://www.imagemagick.org/Usage/compose/
hcorreia
Posts: 7
Joined: 2012-04-11T16:57:25-07:00
Authentication code: 8675308

Re: Convert and draw same command issue

Post by hcorreia »

card.png is the original image before command execution. I created small point.png (1x1) of white color to use in below command. Below is the command which fulfills over requirement.

convert card.png -draw "image SrcOver 0,65 1000,1000 'point.png"' car
dnew.jpeg
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert and draw same command issue

Post by fmw42 »

hcorreia wrote:card.png is the original image before command execution. I created small point.png (1x1) of white color to use in below command. Below is the command which fulfills over requirement.

convert card.png -draw "image SrcOver 0,65 1000,1000 'point.png"' car
dnew.jpeg

For me it does not make it transparent, simply white. Is that what you wanted. I thought your original post was about making a transparent section inside an image. Perhaps I misunderstood what you meant by "blank".
hcorreia
Posts: 7
Joined: 2012-04-11T16:57:25-07:00
Authentication code: 8675308

Re: Convert and draw same command issue

Post by hcorreia »

Sorry for the confusion. I have an index card and needed to blank information or cover it up and only leave the header. The command did that after your correction of course. I cant post files or else I would have post before and after.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Convert and draw same command issue

Post by anthony »

hcorreia wrote:This i my first post and I could not find the answer.
I am using Windows XP to run IM. I have an image that I am trying to put a blank image over a certain area. I have created a blank image 1x1 I go to my directory and run the command below and get the error also below
convert card.png -draw 'image SrcOver 0,65 1000,1000 point.png' cardnew.png
C:\testi[/color]ng>convert card.png -draw 'image SrcOver 0,65 1000,1000 point.png' cardn
ew.png
convert.exe: Non-conforming drawing primitive definition `image' @ error/draw.c/
DrawImage/3146.
...[/color]

Can anyone tell me what I am doing wrong?
Thank you

You did not add single or double quotes around the filename in the draw.

However is their some reason you specifically want to overlay using draw? By not use -composite
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
hcorreia
Posts: 7
Joined: 2012-04-11T16:57:25-07:00
Authentication code: 8675308

Re: Convert and draw same command issue

Post by hcorreia »

Thre is no reason really, I guess I thought this was the correct way of doing this.
How can I redirect the output file to a different folder, do you know?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert and draw same command issue

Post by fmw42 »

hcorreia wrote:Thre is no reason really, I guess I thought this was the correct way of doing this.
How can I redirect the output file to a different folder, do you know?
if using convert, then just put the path to the output image in your command

convert image ..... path2newdirectory/outputimage
hcorreia
Posts: 7
Joined: 2012-04-11T16:57:25-07:00
Authentication code: 8675308

Re: Convert and draw same command issue

Post by hcorreia »

Ok that makes since but do I need to cd like the command below?

convert card.png -draw 'image SrcOver 0,65 1000,1000 point.png' cd../newpath/cardnew.png


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

Re: Convert and draw same command issue

Post by fmw42 »

hcorreia wrote:Ok that makes since but do I need to cd like the command below?

convert card.png -draw 'image SrcOver 0,65 1000,1000 point.png' cd../newpath/cardnew.png


Thank you again

No leave off the cd..

convert card.png -draw 'image SrcOver 0,65 1000,1000 point.png' /newpath/cardnew.png

The directory must exist already and must have write permissions.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Convert and draw same command issue

Post by anthony »

The other technique is to use "mogrify" whcih has a output -path option

However it will generally only use the same basename as the input image.
But mogrify can process multiple images in the same directory.

http://www.imagemagick.org/Usage/basics/#mogrify
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply