Tried to compare two images without alpha channels.
from PIL import Image
from space_tracer import LivePillowImage, LiveImageDiffer
a = LivePillowImage(Image.new('RGB', (100, 100)))
b = LivePillowImage(Image.new('RGB', (100, 100)))
differ = LiveImageDiffer()
differ.compare(a, b)
What happened
It complained about the missing alpha channel.
/home/don/.local/share/virtualenvs/svg-turtle-7kVEgXjr/bin/python /home/don/.config/JetBrains/PyCharm2021.3/scratches/scratch.py
Traceback (most recent call last):
File "/home/don/.config/JetBrains/PyCharm2021.3/scratches/scratch.py", line 7, in <module>
differ.compare(a, b)
File "/home/don/.local/share/virtualenvs/svg-turtle-7kVEgXjr/lib/python3.9/site-packages/space_tracer/live_image.py", line 262, in compare
diff_fill = self.compare_pixel(fill1, fill2, is_missing)
File "/home/don/.local/share/virtualenvs/svg-turtle-7kVEgXjr/lib/python3.9/site-packages/space_tracer/live_image.py", line 334, in compare_pixel
ar, ag, ab, aa = actual_pixel
ValueError: not enough values to unpack (expected 4, got 3)
What I wanted to happen
Make the alpha channel default to 255, the same as changing the code sample above to use mode 'RGBA'.
My environment
Describe the versions of everything you were using:
space_tracer 4.7.0
Ubuntu 20.04
Python 3.9.9
Analysis
Add a helper function to pad pixels to four channels, and call it in compare_pixel(). Think about grayscale images, as well.
What I did
Tried to compare two images without alpha channels.
What happened
It complained about the missing alpha channel.
What I wanted to happen
Make the alpha channel default to 255, the same as changing the code sample above to use mode 'RGBA'.
My environment
Describe the versions of everything you were using:
Analysis
Add a helper function to pad pixels to four channels, and call it in
compare_pixel()
. Think about grayscale images, as well.