Page 1 of 1
Split to RGB and then to individual colors
Posted: 2015-03-19T10:14:40-07:00
by PandoraBox
Hello everyone,
Woke up this morning with a crazy idea that I'm trying to figure out on how to do.
What I am trying to do is to split a image into RGB but as in 1,0,0 not as grayscale but as in the actual red color channel shown as red variations then I want to be able to split the red into 256 images and the same goes for the green and blue.
Reason for this madness : 16 million colors can be layered under a total of 768 images which for me a standard binary grid would really shrink the size of data information when making vectorials.
So if anyone has a way to do this it would be most appreciated.
Thank you all.
Re: Split to RGB and then to individual colors
Posted: 2015-03-19T12:04:03-07:00
by PandoraBox
Also forgot to mention I get this to work I'll be donating 30-50% of all profits to the imagemagick foundation as if I can pull this off I might be able to kill off ugly emoji's
Re: Split to RGB and then to individual colors
Posted: 2015-03-19T13:37:34-07:00
by snibgo
This does the first part of what you ask for. Windows BAT syntax:
Code: Select all
convert ^
in.png ^
( -clone 0 -channel GB -evaluate set 0 ) ^
( -clone 0 -channel RB -evaluate set 0 ) ^
( -clone 0 -channel RG -evaluate set 0 ) ^
-delete 0 ^
out_%%03d.png
It makes out_000.png as a copy of in.png but with G and B channels zero, etc.
[EDIT: corrected r_%%03d.png to out_%%03d.png.]
I don't understand the rest of your needs.
Re: Split to RGB and then to individual colors
Posted: 2015-03-20T00:49:35-07:00
by PandoraBox
@snibgo
First thank you so much for your quick answer was driving me crazy.
For the second part what I need to do is to take each individual color of each of the split rgb to get all 256 split channels for each of the 3 colors.
So if I have a pixel at 1,1 and it's with red 2,0,0 I just want to save each unique color to each separate file for a max total file of 768 images. (256 for the red, green. blue)
I found this but it confused the heck out of me as I think it's more than what I need as I don't need a fuzz just the actual colors
http://imagemagick.org/discourse-server ... hp?t=18751
Thanks again for the help, it's greatly appreciated.
Re: Split to RGB and then to individual colors
Posted: 2015-03-20T01:09:38-07:00
by snibgo
[I've corrected a typo in my code above.]
Correct me if I'm wrong: you want output files called, say, red_000.png to red_255.png, green_000.png to green_255.png and blue_000.png to blue_255.png. EDIT: These are all the same size as the input image.
I'm unsure what each of these should contain. Perhaps red_123.png contains two colours. Pixels that have red=123 in the corresponding pixel of the input file contain one colour. All the other pixels contain the other colour. It doesn't really matter what the two colours are: white and black, or rgb(123,0,0) and transparent-black.
Is that what you want? I can't see an elegant way of doing it. Brute force will work: a command with 256 lines that have something like:
Code: Select all
( +clone +transparent XXX +write YYY +delete )
where XXX is "rgb(123,0,0)" and YYY is "red_123.png", etc.
Re: Split to RGB and then to individual colors
Posted: 2015-03-20T01:39:02-07:00
by PandoraBox
Thanks that's exactly it I've just tested it out with a for loop and works like a charm.
I was complicating things for nothing this information will help me greatly, I know that it's a brute force method however it's not a system hog method so I have no issues with it.