Pinta icon indicating copy to clipboard operation
Pinta copied to clipboard

Average blend & average image resize

Open kevincrans opened this issue 2 months ago • 4 comments

Description While gimp has nohalo and lohalo, good with artefacts, most other editors don't have somethings similarly good, I suggest averaging. The idea is to get a different result, resize analogically explained with both the accuracy of bilinear and color preservation of nearest neighbour. For blend, it will treat every layer equally. I think a basic logical filter would be good for certain artists. I don't like looking back and my same suggestion at paint.net forums, I wrote when I was younger, so I hope I wrote this better. I understood updating the fileformat was too big of a deal, pdn while we use openraster, which doesn't matter on the resize side.

Additional context It's simple and it isn't the same as normal. The image resize will be source>target area-based weight, taking each pixel into account. The blend mode will re-use the transparency slider as the steak the layer will get when blended with the layer below it. (50%, 100% for 2 layers, 33%, 66%, 100% for 3) It will be averaged.

kevincrans avatar Oct 26 '25 14:10 kevincrans

I'm not sure I'm understanding how specifically this proposed resampling method would work .. this would need a more precise explanation

However, anything along these lines would rely on #1232 for being able to add custom resampling methods

cameronwhite avatar Nov 06 '25 03:11 cameronwhite

@cameronwhite Thank you, so the point is that the area is relative to the total size of the image.

When the image is shrinking, it divides and the target area is always 1x1 pixel. If it divides by a full number, like 504x504:3x3=168x168, then the red channels will be added to each-other and divided by 9 (same for the rest and alpha ig bluntly). It should be rounded and don't bother some perfect divisions, since we count from 0-255.

However if you divide by a not full number, you have to calculate the boundaries like box collision, to calculate how the channel will be scaled for the target pixel and how many weight it adds to the total not full amount of pixel that will be cropped in a pixel, to calculate the average.

If the image is being enlarged, it's just like nearest neighbour, except for the boundary pixels, which is the full image on low resolutions.

Edit: Ppl could create an effect plug-in to make the boundaries proportionate, but distance-based filter, while accurate, is out-of-scope here.

Am I clear, or are there any questions?

kevincrans avatar Nov 11 '25 09:11 kevincrans

Thanks for the explanation. Has this method been implemented before and proved to be a useful alternative to existing methods?

cameronwhite avatar Nov 16 '25 22:11 cameronwhite

Thanks for the explanation. Has this method been implemented before and proved to be a useful alternative to existing methods?

This is the best area-resize example I could find: http://halo.gen.nz/pil/examples.html In my experience, any alternative filter is useful when scaling textures, pixel art or gui. This filter is more predictable and the blend mode balanced, as far as rgb intensity goes.

kevincrans avatar Nov 19 '25 22:11 kevincrans