ehmkah / imgdiff

ImgDiff is a plugin for IntelliJ which shows the diff between two images in IntelliJ's diff screen
Apache License 2.0
17 stars 1 forks source link

Allow swap cursor to easily spot differences #60

Open markov00 opened 3 years ago

markov00 commented 3 years ago

Is your feature request related to a problem? Please describe. When having to deal with very small differences between images, is difficult to easily spot them when using the white background. In my case for example I'm tracking differences in charts where circles are drawn with a slightly different technique or with a slightly different radius. The actual difference is just a few bytes but its interesting can be hardly visible on the current implementation.

Describe the solution you'd like As provided by the rich diff in GitHub, a swipe function to swipe between the two overlapping images can be very helpful to spot such differences easily and compare the two images.

Describe alternatives you've considered An alternative is to increase the contrast or at least make configurable the diff color used on the "white background" view. This can increase the contrast with the background and easing the visibility of differences

Additional context One example of differences that are barely visible

Screenshot 2021-01-29 at 10 07 50

This is anyway already a great and very useful plugin! Thank you

ehmkah commented 3 years ago

Thank you for ypur feedback.

Good idea. The plugin is built very simple. It just uses the image-editor in the middle. This is an intellij-component. I am thinking about your idea.

markov00 commented 3 years ago

all-test-ts-baseline-visual-tests-for-all-stories-bubble-chart-alpha-mixed-visually-looks-correct-1-snap all-test-ts-baseline-visual-tests-for-all-stories-bubble-chart-alpha-mixed-visually-looks-correct-1-snap (1)

Here are two example image, probably it's easier in this case to identify the change but playing with a swipe after going back and forth you can spot it You can check also other images diffs here and also play with the swipe/onion tools from github: https://github.com/elastic/elastic-charts/pull/996/files?short_path=b58f945#diff-b58f945db63e71b6517126923b90ed61173f3f3fe56fbc2504695c09abbe06fd

I've tried using the original background, but sometimes the background is too confusing due to a lot of other geometries around

What do you think of a button - "next different pixel"? (no idea whether is buildable or useable)

I've seen similar tools having the option to quickly spot the differences making the difference blinking on the screen, using a high contrast color (https://github.com/yahoo/blink-diff, https://medium.com/loftbr/visual-regression-testing-eb74050f3366) or just marking them with a circle around them (I remember one diff tool but can't find it anymore)

The button can be useful but depends if you can group nearby pixels into one unique diff area to avoid having to click a hundred times to find all the pixels

ehmkah commented 3 years ago

First approach I try to create an animiated gif which "blinks" at the difference spots. I am curious how this will look like :-) Some code for showing animated gif can be stolen from https://github.com/howyi/intellij-motivational-gif/blob/master/src/MotivateAction.java

ehmkah commented 3 years ago

Two examples for blinking gifs.

1.) The original image changes with the red marked differences example1

2.) The original images changes with the changed image. example2

My first impression is that approach 1 makes it easier to detect the changed spots. What do you think?

markov00 commented 3 years ago

Hi @ehmkah first thank you for the efforts on that. What if instead of making blinking the image, we just blink the red diff keeping the image in the background? it reduces the eye stress when looking at the image (and probably reduce the possibility of an epileptic attack 👀 )

ehmkah commented 3 years ago

Like this. The blinking frequency might be tuned a little bit example3

markov00 commented 3 years ago

Yep definitely, I think this is can be very helpful and less distracting then the other version. As option or default behaviour instead of blinking the user can just click a button to block one time, as you don't need a pulsating effect but just discover the small diff (if you think of a big diff situation, the blinking can be too aggressive it continuous, instead just blink one time on the user action can be more effective

ehmkah commented 3 years ago

Bildschirmfoto 2021-02-26 um 22 57 12 OK - now there is a first draft. If you want you can test it. Its in branch 60 (https://github.com/ehmkah/imgdiff/tree/60) . Just check it out, and run gradle runIde - this starts a new intellij where the plugin is installed without touching your real intellij.

I am playing a little bit and will release it soon as experimentel feature because a lot of things are really uggly

ehmkah commented 3 years ago

i release version 1.9.0 of the plugin. It will be available during the next days - Waiting for your feedback.

@grigala - Thanks for your support implementing this feature :-)

grigala commented 3 years ago

Nice to see it go live! Thanks for the credit. I'm glad if I helped, and I'm excited to work on it further during the next Hackergarten event maybe... 🤙