Gimp-Forum.net
Change Amount Channels In Pic - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: Change Amount Channels In Pic (/Thread-Change-Amount-Channels-In-Pic)

Pages: 1 2


RE: Change Amount Channels In Pic - rich2005 - 01-19-2021

Quote: For instance, it could be colored #YYBB, #RRCC, or #MMGG, instead of #RRGGBB.

Repeating myself. Gimp is a RGB editor Three colour channels not two, not four, three channels Red Green & Blue.

You want YYBB yellow and blue ? But 100% yellow is 100% red + 100% green. Lighter shades of yellow have blue added.

You can decompose an image into various colour modes RGB CMY Colours -> Components -> Decompose and blank out one of the colours example: https://i.imgur.com/qslCQ9l.mp4 However the recomposed image is still 3 RGB channels.

Obviously Gimp is not the tool for you. I have used plenty graphic editors over the years and have not come across anything for your requirements.


RE: Change Amount Channels In Pic - Ofnuts - 01-19-2021

(01-19-2021, 01:10 PM)Winston Wrote: There seems to be a miscommunication.

I'm trying to program a picture file to have 2-channel color, not have one with 3-color only have 2 colors.

For instance, it could be colored #YYBB, #RRCC, or #MMGG, instead of #RRGGBB.

We hear this. But there is no image format that supports this, at least none that is natively supported in GIMP. So out of the box you have to work with a 3-channel format where one channel remains unused. This isn't as wasteful as it looks since the compression algorithms can be expected to take this uniformity in account. Or you know how to program and write your own file load/save plugin (all file formats in Gimp except XCF are implemented as plugins...)

(01-19-2021, 01:10 PM)Winston Wrote: Black-&-White would still be possible, writing as #0000 for black, #8080 for gray, and #FFFF for white. #FF00 would be one color, #00FF would be the inverted color.

Using a different program, I tried looking for "03" hexadecimally in the beginning of picture files representing three colors, and changing it to "02", that didn't work.

Where is this "3" stored in an image file? Is it "2" because it starts from 0; 0=1, 1=2, 2=3? If that is the case, would changing it to 1 (=2) work?
Most image formats (except very basic BMP and TGA) are compressed, so you won't see the pixel values in a hex editor.

A possible solution for you is to color-index the image using a color palette that only contains the colors you want, that would give you 16 levels of luminosity and 16 levels across the color range (and you would use one byte per pixel when encoding the image). Or combos are possible as long as you have 256 colors total. And you can change the image by just changing colors in the color map. The GIF format is based in color-indexing (in fact, GIMP's color-indexed image mode is meant to edif GIFs), and is also a supported variant of PNG.


RE: Change Amount Channels In Pic - Winston - 01-19-2021

Well, could you give me a list of files that can read 2-channels? (Optional setting up to be BY, GM or RC in the header?)

Also, how is it not possible if you can have 1 for B&W, 3 for RGB, 4 for RGBA, etc. Not the 2-channel like black-and-white-alpha, but would "Stereochrome" be the word for it?

At the same time, I could alter audio channels to have 3 speakers (or more) in a WAV file. By the makers of WAV & AVI, what is the image format, if possible?

"Or you know how to program and write your own file load/save plugin (all file formats in Gimp except XCF are implemented as plugins...)"

Could you link a free Windows 10 app that can make this sort of plugin?

Note; I made a 3-channel #YBA colored file that works in my browser app, in the code of the page changes Red to Yellow, Green to Blue, Blue to Alpha. This isn't a website, but a page on my computer that changes the colors. Looking at the picture normally looks pycheodelic, but it works in the page. BUT, how to make a 2-channel picture? (Also, when I make my plugin, would it be possible to code what 2 colors to use? Like, in hex, 00=Black-White(Mono), 01=Yellow-Blue, 02=Red-Cyan, 03=Magenta-Green? And possibly, change a byte to say "Read this color first/last" to make something like Red-Cyan change to Cyan-Red?)


RE: Change Amount Channels In Pic - eepjr24 - 01-20-2021

I don't know how to explain to you more than Rich and Ofn already did. I think maybe this goes into a bit more detail, maybe it will help?

https://helpx.adobe.com/photoshop/using/color-modes.html

Plugins for GIMP can be written in python (free and open source) or C (free and many compilers available: https://www.downloadcloud.com/c-compiler-for-windows.html). Probably could be written in about anything you can compile to an exe in windows since you can shell out via pdb, but those look to be the most common.

Comparing image channels to audio channels is not helpful as they are not at all equivalent. HDMI 2 supports 32 audio channels, but that doesn't mean you could have a 32 channel image.

- E


RE: Change Amount Channels In Pic - Ofnuts - 01-20-2021

(01-19-2021, 11:54 PM)Winston Wrote: Well, could you give me a list of files that can read 2-channels? (Optional setting up to be BY, GM or RC in the header?)

None I know of... In theory in the JPEG format you could omit one of the Cb or Cr channels, but this doesn't give you complete freedom on what you put in the remaining channel

(01-19-2021, 11:54 PM)Winston Wrote: Also, how is it not possible if you can have 1 for B&W, 3 for RGB, 4 for RGBA, etc. Not the 2-channel like black-and-white-alpha, but would "Stereochrome" be the word for it?

Because it there is very little use for this, and is easily implemented by just ignoring one of the channels. FWIW in games some images formats are "abused" and the Alpha channel is repurposed (reflectivity, direction, or else)

(01-19-2021, 11:54 PM)Winston Wrote: At the same time, I could alter audio channels to have 3 speakers (or more) in a WAV file. By the makers of WAV & AVI, what is the image format, if possible?

Yes but this is images we are taking about. Over the years they produced audio systems with 1/2/3/4/5 speakers (or groups of), but since the dawn of times there are only two kinds of image displays, monochrome and RGB. So, whatever you do, at some point your image must have three channels to be displayed, unless you want to cook up your own display hardware and operating system.

(01-19-2021, 11:54 PM)Winston Wrote: "Or you know how to program and write your own file load/save plugin (all file formats in Gimp except XCF are implemented as plugins...)"

Could you link a free Windows 10 app that can make this sort of plugin?

This is called a "brain" with some programming skills and some standard programming tools (hint: there is a python interpreter in Gimp for Windows and NotePad++ is free). Not every problem in the universe can be solved with a silver bullet "app" (for instance, creating the apps themselves).

(01-19-2021, 11:54 PM)Winston Wrote: Note; I made a 3-channel #YBA colored file that works in my browser app, in the code of the page changes Red to Yellow, Green to Blue, Blue to Alpha. This isn't a website, but a page on my computer that changes the colors. Looking at the picture normally looks pycheodelic, but it works in the page. BUT, how to make a 2-channel picture? (Also, when I make my plugin, would it be possible to code what 2 colors to use? Like, in hex, 00=Black-White(Mono), 01=Yellow-Blue, 02=Red-Cyan, 03=Magenta-Green? And possibly, change a byte to say "Read this color first/last" to make something like Red-Cyan change to Cyan-Red?)

As said above, whether you use Gimp or not, at some point your image must be RGB to be displayed. How you map you two channels to RGB values is completely up to you. Typically I would use a CLUT for this: two channels -> two bytes -> A 16-bit word -> an index into a table with 65536 RGB entries. To change the output you just change the CLUT. And yes, this is like color-indexing, but using 16-bit indices instead of 8-bit ones.


RE: Change Amount Channels In Pic - Winston - 01-24-2021

If no luck with still images, is the RGB pixels the same with videos?

(AVI, WMV, MOV, MP4, RM, SWF, FLV, F4V, VOB, and so...)

And if I am lucky that works with 2-pixel color (RC/GM/BY), I'll try to make a 1-frame video with limited colors...