Skip to content

feat: add pixelate and pseudo-pixelate - #469

Draft
RobertMueller2 wants to merge 13 commits into
Satty-org:mainfrom
RobertMueller2:feat_pixelate
Draft

feat: add pixelate and pseudo-pixelate#469
RobertMueller2 wants to merge 13 commits into
Satty-org:mainfrom
RobertMueller2:feat_pixelate

Conversation

@RobertMueller2

@RobertMueller2 RobertMueller2 commented Mar 27, 2026

Copy link
Copy Markdown
Member

Closes: #90
builds on #600 and #555 because it doesn't make sense otherwise
I think the commits are a bit of a mess now, but it'll get better when the prereqs are merged.

This implements a pixelate tool with two modes

  • regular mode with a normal block pixelation, this is, depending on selected area and image resolution, reversible
  • "independent mode" or pseudo-pixelate that takes data from outside the selected area and applies distance weighting. The original area is entirely overwritten by the interpolated data. Then, the regular pixelation function creates a block-pixelate look from this.

Some things are still open:

  • figure out a better icon - help needed please. for both pixelate and pseudo-pixelate
  • reach out to flameshot guys regarding credits
  • double check if south and east buffers aren't actually off by one
  • figure out if BLOCKSIZE is good at a value of 32. This may actually need to be adjustable. Follows size+annotation-size-factor now. Annotation-size-factor gets rounded to 1, S is 4, M is 8, L is 16. These values may need some fine tuning in the future.
  • find a user friendly solution for "selected area too small to pixelate". Shows different colours for rectangle now. But perhaps needs more conditions, e.g. when there's no fringe, the pixelation can fail as well.
  • alt is probably not a good way to switch between pixelate and pseudo-pixelate, it's inconsistent with other tools. implement as variant mode on top of refactor: use custom component for tool buttons to allow grouping #600. Now removed in favour of distinct tool entries.
  • indicate editing consistent with feat: indicate active editing in toolbar #444
  • add redact mode - perhaps we can take into account the luminance of the surrounding area and switch between black and white.
  • result depends on scaling, this bug was copied from blur (also see Blur result depends on scaling #602)

Known limitations:

  • in pseudo-pixelate mode, canvas background may contribute to the mix of pixels if the selection is started at image origin
  • in pseudo-pixelate mode, if the selection "leaves" Satty's window, nothing happens. We would be lacking one fringe in that instance.

This PR was inspired by

Regarding the credits, the idea with taking "fringes" was taken from said PR, but I reimplemented the gist of it according to my understanding. I did, for example, skip any additional noise which might be suitable for adding later. Also, actually iterating the source (fringes) and target data (overwritten area) works a bit different due to the objects used. I don't think we need to talk about a separate licence for this bit, but we'll see what the flameshot guys say about this.

pixelation2.mp4

@RobertMueller2

RobertMueller2 commented Mar 27, 2026

Copy link
Copy Markdown
Member Author

for brighter images, the "independent mode" result is a bit too bright. Maybe the weighting math isn't great yet.

EDIT: need to divide everything by two if I have a a horizontal and a vertical influence, they each add to 1. that looks a lot better. Unfortunately, now I have to redo the recording.

@RobertMueller2

Copy link
Copy Markdown
Member Author

Perhaps we also really need to call this "pseudo-pixelate", no need to re-invent lingo? 😉

@RobertMueller2 RobertMueller2 changed the title feat: add pixelate and "independent" pixelate feat: add pixelate and pseudo-pixelate Mar 28, 2026
@robertwidfen

Copy link
Copy Markdown
Collaborator

Regarding the icon, maybe "checkerboard"?

satty-pixelate-icon-checkerboard

But I like "eye-off-regular" better as it fits more into the existing icons.

satty-pixelate-icon-eye-off-regular

Also I see a small issue if the pixelate region is a the border and covers less than one "pixel" in width/height it will not pixelate anything.

satty-pixelate-issue-at-border

@RobertMueller2

Copy link
Copy Markdown
Member Author

Also I see a small issue if the pixelate region is a the border and covers less than one "pixel" in width/height it will not pixelate anything.

yup, I noticed that too while using/testing this locally, at the very least it needs some indication whether the selected area is big enough or not. That'll need some rework, i'll place this in draft mode for now.

@RobertMueller2
RobertMueller2 marked this pull request as draft May 26, 2026 11:41
@pointydev

Copy link
Copy Markdown

Hey there, just came across this pull and noticed the following in the OP:

  • figure out if BLOCKSIZE is good at a value of 32. This may actually need to be adjustable.

On Flameshot this is handled using the scrollwheel to change tool size (also the case for the rest of the sized tools, such as line width, etc). I personally use a tool size of 2 on most occasions, equating to 6px blocks for me:

Adjustable block size would be highly appreciated as it can help emphasise that an area is meant to be pixelated in a final image, depending on the scale of the surrounding elements.

@robertwidfen

Copy link
Copy Markdown
Collaborator

Thank you for sharing this. Personally I do not switch the tool size much, but I like the idea for blur and pixelate, there the S-M-L might not be sufficient. Pixelate so far does not take S-M-L into account.

I was also thinking about integrating pixelate into the existing blur tool to avoid adding another toolbar button. But currently we have no concept of tool individual styles, which might be handy to switch between blur/pixelate, add double arrow, switch rounded rectangle on/off, etc.

@RobertMueller2

Copy link
Copy Markdown
Member Author

I would tie it to S-M-L and annotation size factor, and a static modifier, which is from top of my head what the other tools do. I wouldn't add a scroll wheel logic specifically for this -- but the scroll wheel does work on the annotation size, so at least there's that. ;)

@RobertMueller2

Copy link
Copy Markdown
Member Author

I was also thinking about integrating pixelate into the existing blur tool to avoid adding another toolbar button. But currently we have no concept of tool individual styles, which might be handy to switch between blur/pixelate, add double arrow, switch rounded rectangle on/off, etc.

If such a concept was ready to use, I might add this to the blur tool. But actually coming up with a concept and discussing it, I think we should open a separate issue :)

Closes: Satty-org#538

prereq for Satty-org#469

builds on Satty-org#555 because it makes no sense otherwise.

This allows grouping tools under one button.
E.g. arrow and line, rectangle and circle

Used FactoryComponent along with FactoryVecDeque because that simplified
reference storage on the toolbar.
Closes: Satty-org#90

This implements a pixelate tool with two modes
- regular mode with a normal block pixelation, this is, depending on
  selected area and image resolution, reversible
- "independent mode" that takes data from outside the selected area, the
  area is entirely overwritten by this. Then, the regular pixelation
creates a block-pixelate look.

Some things are still open:
[ ] figure out a better icon - help needed please
[ ] reach out to flameshot guys regarding credits
[ ] figure out if BLOCKSIZE is good at a value of 32. This may actually need
to be adjustable.

Known limitations:
- in independent mode, canvas background may contribute to the mix of
  pixels if the selection is started at image origin
- in idependent mode, if the selection "leaves" Satty's window, nothing
happens. We would be lacking one fringe in that instance.

This PR was inspired by
- https://github.com/flameshot-org/flameshot/pull/3765/changes
- Satty-org#468 by kikeijuu (superseded by this PR)

Regarding the credits, the idea with taking "fringes" was taken from
said PR, but I reimplemented the gist of it according to my
understanding. I did, for example, skip any additional noise which
might be suitable for adding later. Also, actually iterating the source
and target data works a bit different due to the objects used. I don't
think we need to talk about a separate licence for this bit, but we'll
see what the flameshot guys say about this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] low res pixel blur

3 participants