Page 1 of 1

Change color

Posted: 2015-04-07T00:35:49-07:00
by fohnbit
Hello!

I´m totally new with ImageMagick. I use Ubuntu x64.

I have a lot of PNG, with indexed color (only black) with transparent Background.

I need different colours of this .png files.
Is it possible with ImageMagick?

Thank you!

Re: Change color

Posted: 2015-04-07T00:40:36-07:00
by snibgo
To change black into (say) red:

Code: Select all

convert in.png -fill red -opaque black out.png

Re: Change color

Posted: 2015-04-07T01:31:31-07:00
by fohnbit
Hello!

Many thanks to this fast reply, but there are still black colors.
Also the transparenz of the black color I lost.

Attached the original and the converted to red.

In the Red Picture you see it is different too the original.

http://de.tinypic.com/r/34nruba/8 (original)
http://de.tinypic.com/r/1zwz2w7/8 (converted to red)

Re: Change color

Posted: 2015-04-07T01:55:27-07:00
by snibgo

Code: Select all

convert in.png -alpha off -fill red -opaque black -alpha on out.png

Re: Change color

Posted: 2015-04-07T02:12:47-07:00
by fohnbit
The Hello!

Thank you ... near to the result who I need.
Now it is complete red, but the black parts (with some transparenz) are now filled.
Did you know what what I mean?

The smooth edges of the black color is now hard in red.

Re: Change color

Posted: 2015-04-07T02:25:19-07:00
by snibgo

Code: Select all

convert in.png -alpha off -fill red -opaque black -alpha on out.png
For me, IM v6.9.1-0, the alpha values in out.png are the same as in.png.

Re: Change color

Posted: 2015-04-07T02:45:48-07:00
by fohnbit
Hi!

I use Windows 6.9.1-1-Q16-x64 ... maybe this is the problem?

Re: Change color

Posted: 2015-04-07T03:42:09-07:00
by fohnbit
Hello again!

I checked the files .. some are indexed colours, some are RGB.
Is for RGB the same command?

Re: Change color

Posted: 2015-04-07T03:46:06-07:00
by snibgo
The same command is used for RGB and indexed files.

What version of ImageMagick do you use?

Re: Change color

Posted: 2015-04-07T04:21:54-07:00
by fohnbit
I use 6.9.1.1.Q16-x64 on Windows 8.1 x64.

I also tried 6.9.1.1.Q8-x64 ... same result.

Is there somewhere a link to 6.9.1-0 ?

Re: Change color

Posted: 2015-04-07T04:27:29-07:00
by snibgo
6.9.1.1 should be fine.

I examined the alpha values with Gimp. My result is:
Image

Re: Change color

Posted: 2015-04-07T04:44:58-07:00
by fohnbit
Ok, I guess with my english I could not describe it clearly.
I have the same result, but it is not same as original.

When you check the original Image, you can see there are some pixel semi-transparent (when you open in Gimp and zoom in).
After convert, it lost this semi-transparent pixel and show full color pixel.

Did you know what I mean?

Thank you for your great help(!)

Re: Change color

Posted: 2015-04-07T05:28:25-07:00
by snibgo
In Gimp, I zoom to 800% and use the eyedropper tool. This tells me the pixel values. The background has alpha = 0%. The red guitar has alpha at many values, including 1%, 5%, 11%, 12%, 43%, 47%, 77% and 100%.

Re: Change color

Posted: 2015-04-07T05:56:26-07:00
by fohnbit
Ok, that is strange!
Which Version of Gimp you are using?

Re: Change color

Posted: 2015-04-07T06:46:12-07:00
by fohnbit
Hello!

I open the new File with Windows paint, and he show me the image correct.
So it must be a problem of Gimp.

Thank you for your help ... it is solved(!)