[Solved] Color modification of multiple images

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
manateemermaid
Posts: 2
Joined: 2012-07-06T17:05:16-07:00
Authentication code: 13

[Solved] Color modification of multiple images

Post by manateemermaid »

Dear Forums,

I am trying to create text by adding letter by letter after one another. Each letter is contained in a separate file.
Building words works, but I have problems coloring each single letter.

So for writing "AB" my imgmagick code looks similar to this:

Code: Select all

convert -gravity West -size 173x270 xc:none \
	65-1.png -geometry +10+0 +level-colors 'rgb(240,24,105)' -composite \
	66-2.png -geometry +99+0 +level-colors 'rgb(51,240,24)' -composite \
renders/output.png
I am trying to color the letter files via the "+level-colors" parameter. Unfortunately, everything is in one single color, although each line has a different RGB value. If I'm testing with "-level-colors" it has a neon look, but every letter has a different color.

I already RTFM, but apparently did not understand correctly. Please help me.
What am I doing wrong? Is there maybe another operation to achieve the effect I want?
Last edited by manateemermaid on 2012-07-07T11:49:30-07:00, edited 2 times in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Color modification of multiple images

Post by fmw42 »

What color are each letter and on what kind of background. +level-colors is perhaps not the best way to do that. But you need to do it inside parenthesis so that you color each image separately. can you post a link to your two A B images? If they are say white on black or white on transparent, then you can probably just use -colorize or -fill newcolor -opaque oldcolor. It is hard to tell without seeing your images, what to recommend.

see
http://www.imagemagick.org/Usage/color_mods/#colorize
http://www.imagemagick.org/Usage/color_basics/#replace
http://www.imagemagick.org/Usage/basics/#parenthesis
manateemermaid
Posts: 2
Joined: 2012-07-06T17:05:16-07:00
Authentication code: 13

Re: Color modification of multiple images

Post by manateemermaid »

Thanks, fmw42, your answer was very helpful.
The images are black to white to alpha, so they have a white "outline", which blurs to transparency. I got it working the way I wanted by putting each command into parentheses and switching from one color to two colors, which looks like this now:

Code: Select all

convert -gravity West -size 173x270 xc:none
	\( 65-1.png -geometry +10+0 +level-colors 'rgb(111,13,210)',white \) -composite 
	\( 66-1.png -geometry +99+0 +level-colors 'rgb(13,210,62)',white \) -composite 
renders/output.png
White as a second color nicely creates the outcome I wanted, but I will look into the other operations you linked as well.
Thanks again, this was truly helpful.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: [Solved] Color modification of multiple images

Post by anthony »

You do not need to specify the 'white' just the comma ',' if not given 'black' and 'white' are assumed.
Without a comma, IM thinks you want to reset all the colors in the image (change both black and white)

See IM Examples, Level Adjustment by Color
http://www.imagemagick.org/Usage/color_ ... vel-colors
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply