Page 1 of 1

[Solved] Color modification of multiple images

Posted: 2012-07-06T17:21:01-07:00
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?

Re: Color modification of multiple images

Posted: 2012-07-06T19:31:26-07:00
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

Re: Color modification of multiple images

Posted: 2012-07-07T11:48:28-07:00
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.

Re: [Solved] Color modification of multiple images

Posted: 2012-07-08T19:50:08-07:00
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