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 » 2019-06-18T08:05:05-07:00

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: 12156
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Change background color

Post by snibgo » 2019-06-18T08:12:53-07:00

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 » 2019-06-18T08:24:58-07:00

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 » 2019-06-24T00:30:56-07:00

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: 12156
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Change background color

Post by snibgo » 2019-06-24T06:04:14-07:00

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