Alpha channel
Jul 29 2010, 11:52 pm
By: rockz  

Jul 29 2010, 11:52 pm rockz Post #1

ᴄʜᴇᴇsᴇ ɪᴛ!

Would go in tech/computers, but I figure artsy people are here more.

I want to either make or convert an image so that it has a limited alpha channel, ie each pixel would be RRGGBBAA on a 32 bpp image, I want RRGGBBA, or a 28 bpp image. It doesn't matter that no format supports 28 bpp. Really all I want is instead of 0-255 alpha, I want 0, 16, 32, 48, 64, 80, 96, 112, 128, etc... values for alpha (maybe less). Perhaps you photoshop folks might know how to do this?

The workaround I have is in gimp, using threshold alpha to make everything under a threshold set to 0, and over the threshold set to 255. Well that means I have to do it 16 times, as well as some fancy pixel work.

Other than that, if you use the select by color tool in photoshop with only the alpha channel turned on, does it still select by RGB, or by A?



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Jul 30 2010, 1:27 am Apos Post #2

I order you to forgive yourself!

I'm pretty sure a gimp plugin could be made to do that.

For now, I can't think of anything else... (There is always a work around.)




Aug 2 2010, 8:00 pm poison_us Post #3

Back* from the grave

http://en.wikipedia.org/wiki/Pngcrush#Image_manipulation




Aug 3 2010, 9:41 pm rockz Post #4

ᴄʜᴇᴇsᴇ ɪᴛ!

Even though that has nothing to do with my problem, nor does it solve it, it did give me the idea to simply edit the alpha channel as a separate image. Not ideal :(.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Aug 5 2010, 4:16 am EzDay281 Post #5



What is this for?

I could throw together a program that takes an input image and outputs it otherwise unchanged. (Though I don't know how to use libpng or any such; I'd just be using a multimedia library that happens to have built-in png reading and writing support, and can't guarantee that it won't change/remove things other than pixel data - i.e. paletting, metadata, gamma, whatever)
I have no experience with Photoshop, unfortunately.
I can't imagine it not being possible to do this using plugins or scripts in GIMP, though neither have I experience with them.

To clarify: You want to reduce the precision of your alpha channel to 4bpp or other values below 8?



None.

Aug 5 2010, 5:42 am rockz Post #6

ᴄʜᴇᴇsᴇ ɪᴛ!

yeah. I want to experiment with paletted alpha channel apngs (hopefully make my avatar a little prettier).

What I want to do is limit the alpha channel to a certain bit depth, so that I have 4, 8, 16, or preferably any number of values (like 22). I can always change the actual values of the alpha later in the tRNS chunk, but I can't get the tRNS chunk without it being a paletted image first. The more I think about it, it wouldn't be too hard to simply isolate the alpha, convert it to grayscale, reduce the number of colors, reconvert to alpha, paste new alpha into old image, and do whatever else might need to be done.

It's not really something that I can ask someone else to make a program for (unless you want to), since it's not high priority.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Aug 5 2010, 6:11 am EzDay281 Post #7



Quote
What I want to do is limit the alpha channel to a certain bit depth, so that I have 4, 8, 16, or preferably any number of values (like 22).
How do you expect this to help you make your avatar prettier?
(Or, how do you expect to get from it to prettierness?)
Quote
but I can't get the tRNS chunk without it being a paletted image first.
What do you mean by this?
Quote
It's not really something that I can ask someone else to make a program for (unless you want to), since it's not high priority.
It'd mostly be a few small tweaks to a program I already made for batch-transparency...ing? a bunch of linework images I had. My two posts in this thread have probably involved more typing than said tweaks.

edit: Decided to make it because I was bored. (any time or trouble involved demonstrates that I obviously need the practice) It requires dlls. I don't know how to static link (I believe is the term). :(

Post has been edited 3 time(s), last time on Aug 5 2010, 7:33 am by EzDay281.



None.

Aug 5 2010, 3:29 pm rockz Post #8

ᴄʜᴇᴇsᴇ ɪᴛ!

View my avatar on a white background
View what my avatar is supposed to look like on a white background
As you can see, alpha helps tremendously.

Png has various chunks storing the data. IHDR, IDAT, IEND are all that are normally required in color 0, 2, 4, and 6. color 3 requires a PLTE chunk (palette), and has an optional tRNS chunk which defines transparency of each palette entry. For one bit transparency, you only need a tRNS with length of 1 byte (the first palette entry is transparent to whatever the byte says, usually 00). If the chunk is, say 16 bytes long, I can have the first 16 palette entries be a shade of black or gray with a certain alpha channel, so it blends in with the background. tRNS doesn't exist until you palette the image, and GIMP doesn't support paletted transparency.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Aug 5 2010, 5:48 pm EzDay281 Post #9



I'm guessing you don't need the program at this point?

I'm really confused by now, so whatever. :P Asking and having answered more questions would probably just be a waste of both our time at this point. My only experience working with transparent pngs is when programming and drawing, so all I know is that most programs make it a pain to do anything with that channel, not how they make it painful.

Post has been edited 4 time(s), last time on Aug 5 2010, 5:56 pm by EzDay281.



None.

Aug 5 2010, 6:12 pm rockz Post #10

ᴄʜᴇᴇsᴇ ɪᴛ!

Well the second image is with an 8 bit alpha, so I haven't worked on it. I'm surprised my explanation is confusing you, yet you know how to limit the alpha channel (as I have no idea).



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Aug 5 2010, 6:23 pm EzDay281 Post #11



Quote
Well the second image is with an 8 bit alpha, so I haven't worked on it.
And I'm currently wondering how lowering alpha precision can improve it.
Quote
I'm surprised my explanation is confusing you
Like I mentioned, most of my experience with alpha channels allows me to either explicitly set them to what I want numerically (programming), or I don't need to care about precision or doing anything per-pixel (drawing).
And in the former case, thresholding to arbitrary fractions of 256 requires nothing more than a pair of for loops and a thresholding function. Hell, the thresholding function was the "hard" part (if confusing myself for two minutes counts as hard).



None.

Aug 5 2010, 6:41 pm rockz Post #12

ᴄʜᴇᴇsᴇ ɪᴛ!

It's 223 kB. I want to cut it down to ~30 kB without losing much alpha.

I forgot that BMP supports RGBA. is that how you edit it?



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Aug 5 2010, 6:50 pm EzDay281 Post #13



Quote
I want to cut it down to ~30 kB
Ah, that's the important part. I don't know if it's fully compressed or not, but reducing one of my lineworks to 2 levels of alpha reduced it from 9.99KB to 3.20, so it sounds like this may be able to help you.

Quote
I forgot that BMP supports RGBA. is that how you edit it?
I've never worked with transparent bitmaps (aside from single-bit paletteds), so no.



None.

Aug 5 2010, 7:10 pm rockz Post #14

ᴄʜᴇᴇsᴇ ɪᴛ!

well, my optimized 1 bit alpha gif is ~16 kB. Due to the way the png palette works, I'd probably get to that again. Essentially what it does is create an RGBA palette rather than an RGB palette with 1 transparent color. That means the size of the image shouldn't change much. The problem is getting it to 256 RGBA colors, since everything treats the alpha channel as separate. It would be cool if I could do CYMK then transfer K to alpha, but that's just not how things work.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Aug 5 2010, 7:31 pm EzDay281 Post #15



Meh. Your grammar is confusing. Terminology I understand, sentence structure... not so much.

What program do you use to edit that with, anyways? When I open it in GIMP it's considered a still image.



None.

Aug 5 2010, 7:41 pm rockz Post #16

ᴄʜᴇᴇsᴇ ɪᴛ!

There's an apng plugin for gimp, but it doesn't work very well. I'm using the command line tools: apngasm.exe, apngdis.exe, gif2apng.exe, apng2pngseq.exe, and pngseq2apng.exe. Each either splits or combines the pngs, so I just use gimp and edit each png individually.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[11:47 am]
TF- -- :wob:
[11:47 am]
TF- -- orolorbâdea dorbâdea!
[01:13 am]
Ultraviolet -- :wob:
[2024-12-19. : 1:28 pm]
UndeadStar -- :wob:
[2024-12-19. : 2:22 am]
RIVE -- :wob:
[2024-12-18. : 11:24 pm]
jjf28 -- :wob:
[2024-12-18. : 5:24 pm]
Ultraviolet -- :wob:
[2024-12-18. : 8:01 am]
Zycorax -- :wob:
[2024-12-18. : 5:26 am]
1nFectEd -- :wob:
[2024-12-18. : 5:23 am]
1nFectEd -- Got a nice collection im subscribed to now so im happy
Please log in to shout.


Members Online: jun3hong, Moose