Change background color

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
Gurthfin
Posts: 11
Joined: 2013-04-30T18:16:11-07:00
Authentication code: 6789

Change background color

Post by Gurthfin »

Hello,
I want to change background color of image as i can with Photoshop Express App function Dappled. It can change grey background color to blue without "change foreground" color (text, frame). I wanna duplicate this effect and with more colors (In PSE app i only find to blue).

Original File:
Image

PSE file:
Image

My try with IM +level-colors blue
Image
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Change background color

Post by snibgo »

See the "+level" documentation at http://www.imagemagick.org/script/comma ... .php#level

It takes two colours, for the black point and white point. Your command changes black to blue. But I think you want black to stay black, and change white to light blue, eg #ddf:

Code: Select all

magick bard-1.png +level-colors black,#ddf out.png
snibgo's IM pages: im.snibgo.com
Gurthfin
Posts: 11
Joined: 2013-04-30T18:16:11-07:00
Authentication code: 6789

Re: Change background color

Post by Gurthfin »

So I was one step from complete T_T . Thank you very much.
Gurthfin
Posts: 11
Joined: 2013-04-30T18:16:11-07:00
Authentication code: 6789

Re: Change background color

Post by Gurthfin »

One more question:How to not colorize alpha channel(edge of card)? I want to print all cards (about 350), its waste of toner. I tried alpha off, but didnt work. When I look at base card in Photoshop, it look like there is no alpha channel, but edges are transparent.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Change background color

Post by snibgo »

You can restrict operations to just the RGB channels:

Code: Select all

magick bard-1.png -channel RGB +level-colors black,#ddf +channel out.png
snibgo's IM pages: im.snibgo.com
Post Reply