This is more of a hypothesis looking for advice than an issue, since I'm not even sure where to begin...
I'm wanting to take a heap of grayscale 8-bit images and layer them on top of each other by using 'compose add' into a 16-bit grayscale, but I want to make sure those 256 colours are a consecutive 256 range of grays out of 65536. What I mean is, it should be a range like 0-255/65536 (instead of 256 steps of gray between each pixel), and when I use 'compose add' in 16-bit, 2 of them would equal a range of 512, 4 of them 1024, 8 of them 2048, etc.
Ideally the limit of layers to compose would be 8, so specifically I'm looking at trying to make sure the 256 range of 8-bit grays (0-255) equate to a 16-bit range of 0-8191 (a maximum gray equal to that of 32 in 8-bit), if my math is correct, that should mean 'compose add' on those 8 images would give me the full range of 16-bit from pure black to pure white. It should mean, what used to take 256 pixels to have unique columns/rows of grays could now be 2048 and still be unique, without any banding. My method to avoid banding would involve some blur and some roll offset of each image, which should do the trick.
So I guess the first step is converting my 8-bit grayscales to 16-bit and then adjusting the colour correctly, and since I can't see the result because everything I have is 32-bit display, I need some verbose output to see the amount of colours used and the range of brightness from lowest to highest value. I also need to lower my gamma/luminance by a 12.5% exactly after converting to 16-bit, but I'm not sure what I should be looking at since I don't want to plateau my black. Since there is no "luminance" literally I can only think of inverting the colours and then playing with gamma.
So first of all, any advice about getting that range of gray down to 12.5% without losing any information, that would be great. Based on my experience, it's really hard to find something that operates like the "luminance" method I'm used to in Paint Shop Pro, where it adjusts brightness with a bias on white over black, so black would never plateau and bleed out. I think "intensity" is what I'm after but that still goes over my head for now.
Secondly, once I have done that, how to exactly check that the image is okay since I can't actually see it? Just running it through identify seems to give me the min and max but still not entirely sure how to see the exact amount of unique colours used. If correct, I guess it should read "min: 0 (0), max: 8191 (12.5)", and if I can find out it's exactly 256 colours then all should be well. Then, after applying some blur, that amount of unqiue colours should boost from 255 to somewhere upward of 8000, and I'd be ready to roll and compose.
Thanks for any advice about this, I'm sure I'd still be here busy blindly toying with gamma/modulate/levels/etc.
Adjusting 8bit to 'level' and compose properly into 16bit range
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Adjusting 8bit to 'level' and compose properly into 16bit range
How about reading the grayscale (8-bit) inputs, then "-evaluate-sequence Mean", then write the (16-bit) output? That seems to do everything you want.
Of course, you can "-background None -compose Plus -layers flatten" to add the images to each other, then divide by whatever you want. Or do the division before the adding, which is mathematically the same but will take more time.
But I may misunderstand what you want.
Of course, you can "-background None -compose Plus -layers flatten" to add the images to each other, then divide by whatever you want. Or do the division before the adding, which is mathematically the same but will take more time.
But I may misunderstand what you want.
snibgo's IM pages: im.snibgo.com
Re: Adjusting 8bit to 'level' and compose properly into 16bit range
I will look into those different approaches, but really the issue I'm having is the division itself. So far I am using "-level 0%,282.85%,0.5", which takes that 255/65536 gray and makes it just shy of 8192, according to identify. I have no idea why it's that percentage, but that's what I whittled it to. I would have thought 12.5% or 800% was what I'm after, but anyways...
This all almost does what I want, but I am losing so much off the lower spectrum and it is plateauing, unfortunately. I'm convinced I would be getting the whole range of grays otherwise, but, I'm losing too much in process using "level".
I uploaded everything so it might become clearer, but forgive me, I know it must be a hideous approach:-
http://www.violae.net/temp/IMgs8X16.zip
____________________________________________
Not sure how easy this might be to see for anyone else, but, this is the result from a basic linear gradient:-
This all almost does what I want, but I am losing so much off the lower spectrum and it is plateauing, unfortunately. I'm convinced I would be getting the whole range of grays otherwise, but, I'm losing too much in process using "level".
I uploaded everything so it might become clearer, but forgive me, I know it must be a hideous approach:-
http://www.violae.net/temp/IMgs8X16.zip
____________________________________________
Not sure how easy this might be to see for anyone else, but, this is the result from a basic linear gradient:-
Re: Adjusting 8bit to 'level' and compose properly into 16bit range
Ugh, I was under the impression I needed to use a combination of white AND gamma, but actually I only needed white-point, which indeed works out to 800%! I did learn a lot about other ways of adjusting colours and brightness by reading and playing with everything else, at least.
Still not sure how to count unique colours, but XnView can do that.
Still not sure how to count unique colours, but XnView can do that.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Adjusting 8bit to 'level' and compose properly into 16bit range
That is what the histogram will do for you. See https://imagemagick.org/Usage/files/#histogramStill not sure how to count unique colours, but XnView can do that.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Adjusting 8bit to 'level' and compose properly into 16bit range
If you just want to count them:
Code: Select all
magick toes.png -unique-colors -format %w info:
62206
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Adjusting 8bit to 'level' and compose properly into 16bit range
Sorry, I thought he was asking about how many of each unique-color, not the count of unique colors.