Inconsistent getImageData results for calculating text color based on canvas background
I’m working on a feature to dynamically determine the object color (white or black) based on the brightness of the canvas background where the object is placed. I use the getImageData method to calculate the average color and brightness of the background in the area where the text resides. However, I’m experiencing inconsistent results when the background is black.
When add Image as a Background its show white line in the right side in Fabric.js
The issue is when I add a background image with the below method, and then after Zoom Canvas there is an issue when the zoom ratio is odd, like 5%, 7%, 11%, etc.; it shows a white line at the end of the right side but does not show a white line when the canvas size is even. Why has this happened? I actually don’t know