Jump to content
PassiveAggressor

Using Posterize to simulate low bit depths in AP

Recommended Posts

Hi all,

 

One thing that would be very useful pixel art and mobile graphics is to draw in a low bit depth like rgb565 or rgb332.

It would be amazing if AP had such colour formats but I thick that's unlikely.

 

But what you can do is use a Posterize live adjustment layers to simulate them.

Now doing this for formats like 4444 (16 shaded of colour per channel) works great but my problem comes when I try

and simulate formats like 565 where the green channel has a different bit depth to the other.

 

To do this you need to use 2 posterize layers, one for red and blue (at 32 shades) and one for green (at 64 shades).

 

and here's my problem. I cant get the blend ranges of these posterize layers to work!

I need to get them to only effect certain channel which I tried to do by dragging down the "Underlying Composition Ranges"

for the other channels but it doesn't work.

 

Not sure if this is a bug or I'm just doing something wrong,

 

Any Ideas?

 

Thanks,

Passive

 

Share this post


Link to post
Share on other sites

your idea is very good and the problem is really interesting 

 

I think I have a solution but please check and report back if it does not work 

 

(for others that do not know blend if yet)

 

you may want to delete the edge points and thus make the transition line in the blend if channel a linear one (bottom left to top right, thus affecting not only pure r/g/b colors but also mixtures

V2 rgb332.afphoto.zip

Edited by MBd

 

 

Share this post


Link to post
Share on other sites

Thanks for the reply MBd,

 

I had a quick play with your file and although it looked perfect when I loaded it up, I found that if I adjusted one of the posterize layers under the linear group (say green) it either didn't have an effect or it effected more than one layer.

 

If you try changing say the green layer do you get the same result?

 

Cheers,

Passive

Share this post


Link to post
Share on other sites

do you have a reference image before/ after?

 

the `edge` package behaves strange on normal images because it does not affect shades (looks great in the sample image though) of R / G / B respectively but the `linear` one should behave correctly (on real images) as far as I can tell, It definitely affects the other channels/ more precisely shades of their own channel in other channels as well but this is how it should be I think

 

can you test both on an actual image where you know the output?


 

 

Share this post


Link to post
Share on other sites

Oh I didn't notice the edge ones, and they work exactly as expected/wanted, thanks very much!

 

Out of interest, here are the Blend Ranges for the red channel:

 

post-57168-0-73559600-1496514301_thumb.png (click for full image)

 

I must not understand the underlying composition layers correctly, when I tried to do this I had them inverted to how you did them.

I thought for the red channel to be the only effecting channel its graph would be at the top and the green & blue would be at the bottom.

 

thanks again,

Passive :)

Share this post


Link to post
Share on other sites

the "strange" thing is that the edge layers don't actually change real images so I'd be interested to hear how this works out for you, what the use case is.

 

look at the channels tab and toggle between the channels, look what is black and white and then adjust the blend if accordingly 


 

 

Share this post


Link to post
Share on other sites

my best guess is that this is either Affinitys rendering, maybe output to TIFF and check again, or it is Affinitys Posterize algorithm 

 

or I missed something but nothing I can currently thing of, sorry 


 

 

Share this post


Link to post
Share on other sites

I have probably misunderstood the intent here and/or the desired effect, so this may not do anything close to what you want, but at least it produces some interesting results, so please tell me what you think:

 

I started by duplicating the pixel image layer twice, then named them red, green, & blue for clarity. I selected the red layer & in the Channels panel, I right clicked on its green channel (displayed as "red Green") & chose "Clear" from the popup menu. I repeated that for its blue channel, leaving only the red & alpha channels untouched.

 

I repeated that for the other two layers, clearing each of their two 'off-color' channels. Then I posterized each layer separately, using values of 5, 6, & 5. Finally, I changed the blend mode of the top two layers to Difference (although some other blend mode might be better).

 

I think this produces a simulated 565 format -- at least the histogram suggests that, because running the pointer over it, I get 0 pixels everywhere except on the sharp peaks:

post-3524-0-22618400-1496575122_thumb.png

I used a real stock photograph for this test, a dramatic shot of a tropical lagoon at sunset with greenish glowing waves & rich orange & red glowing sky colors, plus some deep shadows, so the original had a wide range of color values. It looks nicely pixelated, so maybe this will be of some use.


Affinity Photo 1.7.1, Affinity Designer 1.7.1, Affinity Publisher 1.7.1; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.1.143 & Affinity Designer 1.7.1.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites

Can you show a comparison of your approach vs the "linear" blend if set?

 

your approach seems very reasonable as well


 

 

Share this post


Link to post
Share on other sites

Can you show a comparison of your approach vs the "linear" blend if set?

Remember in your first reply you posted a link for those who do not understand blend if yet? I am more or less one of those people. I plan on getting more familiar with using it "real soon now," but it could be several days before I get to that.  :unsure:

 

I am still not quite sure what you meant about the `edge` package & such, but I will figure it out & take a shot at the comparison ... eventually.

 

I can say this though: I have just tried the method I described on a few other photos & it seems not to produce any extra shades on any of them, just evenly spaced spikes across each channel's color range. I want to see if I can make a macro to make it easier to do, but it is pretty quick & simple as it is. One nice thing about it is once the document is set up, the posterization levels can be varied individually by keeping the adjustment panel open & clicking on each of the adjustment layers in turn, & just using the slider or text field for the changes.


Affinity Photo 1.7.1, Affinity Designer 1.7.1, Affinity Publisher 1.7.1; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.1.143 & Affinity Designer 1.7.1.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites

yeah just take the file and copy the "linear" group and paste onto your image and see if it is the same as your result, that would be interesting to me at least 

 

(I still think this may very well be the same result but googleing rgb565 does not yield much useful examples so I can not tell)

 

cheers 


 

 

Share this post


Link to post
Share on other sites

yeah just take the file and copy the "linear" group and paste onto your image and see if it is the same as your result, that would be interesting to me at least 

I think we are talking about different things. As I understand it, "true" rgb565 color would allow for 32 (2^5) reds, 64 (2^6) greens, & 32 (2^5) blues, for a palette of up to 65,536 possible colors (32x64x32).

 

I was proposing a method to do something different: using color channel posterization (for my example 5,6, & 5 posterization levels respectively for the red, green, & blue channels). This (I think) forces every pixel to be a mix of exactly 5 discrete red, 6 discrete green, or 5 discrete blue colors, for a palette of up to 150 colors (5x6x5).

 

I am not sure what your "linear" group does or how many colors it allows. I see that it consists of three posterize adjustments, set to 8, 8, & 4 respectively for the adjustment layers named, red, green, & blue, but pasting it into my photo image produces very different results, as indicated by the resulting histogram:

post-3524-0-72627900-1496591828_thumb.png

It posterizes the photo, but in a very different way, with many more dissimilarly colored pixels.


Affinity Photo 1.7.1, Affinity Designer 1.7.1, Affinity Publisher 1.7.1; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.1.143 & Affinity Designer 1.7.1.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites

Ok you probably have the right implementation and mine is crap

I think neither one is the "right" implementation of true rgb565 color depth (as I understand what that term means). They are just different ways to simulate an effect that looks more or less like an image with that kind of limited color palette.

 

I think mine is probably easier to use (which could just be because I know how to do it & yours is still unclear to me) but because Affinity Photo only offers access to color channels of rasterized layers, it is useless for shapes & vectors, so mine is crap for that & yours is not.  B)


Affinity Photo 1.7.1, Affinity Designer 1.7.1, Affinity Publisher 1.7.1; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.1.143 & Affinity Designer 1.7.1.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites

R C-R's solution does give you a "correct" simulation of rgb565 but it doesn't update in real time if you modify the underlying image.

 

I think MBd's solution would work if there was a way to use blend range to block off a channel but I've just realised that's currently not possible.

You can't use a histogram like graph to remove ALL the red channel without effecting the other channels.

 

What we need is some channel checkbox's to filter out channels, which I've just made a feature request for:

 

https://forum.affinity.serif.com/index.php?/topic/40955-channel-filtering-in-blend-ranges/

 

Cheers,

Passive

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×