How to do this in Automagic

Post your questions and help other users.

Moderator: Martin

robchoc
Posts: 81
Joined: 20 Jun 2018 12:38

Re: How to do this in Automagic

Post by robchoc » 01 Nov 2018 22:24

That's my flow, maybe I'm doing something obviously wrong that I can't see.

http://automagic4android.com/flow.php?i ... 3ecbb3755b

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: How to do this in Automagic

Post by Desmanto » 03 Nov 2018 18:25

Probably it is because the metadata. Although 2 images can be almost the same, but the metadata can be different. The avalanche effect from has algorithm make the small difference produce a totally different hash. It seems we can't use the hash method then.

There is function getPixelColor(image_data, x, y) and I use that last time is to report the gray text bug at my phone. After that I never use it anymore, as it is too hassle to use it, CUI is much better and faster.
But it seems this time, it can show its power. You can compare both images, by looping thru the whole pixel of image and compare each pixel. Means you have to loop length and width (x and y). I haven't create the script, but a quick googling search show me this. : https://rosettacode.org/wiki/Percentage ... mages#Java

But it seems that code do much more detail. It compares the RGB portion too, taking the absolute difference of each R G B channel andd add up the differences. It is possible to do so too, by using getRed(), getGreen(), getBlue() (and getAlpha() if you need that too). Loop it and show the total difference in percentage. If it is 95% match, then most likely it is the same already.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply