Robohash icon indicating copy to clipboard operation
Robohash copied to clipboard

One particular IP address crashes, but only on set5

Open ComputerSmiths opened this issue 5 years ago • 3 comments

This is weird:

import robohash rh = robohash.Robohash("65.255.59.74") rh.assemble(roboset='set5')

Traceback (most recent call last): File "", line 1, in File "robohash/robohash.py", line 183, in assemble roboimg.paste(img,(0,0),img) File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1457, in paste self.im.paste(im, box, mask.im) ValueError: bad transparency mask

Change the IP address by one digit, change the set, and it works fine.

pip freeze | grep -i robo robohash==1.0

Am I doing something wrong? Love this program, and it's so helpful in telling when my IP address has changed...

ComputerSmiths avatar Feb 22 '20 11:02 ComputerSmiths

Also fails on 65.255.57.69 if that helps I've done try/except and use set=3 as a workaround, but it'd be nice to use set5

ComputerSmiths avatar Feb 22 '20 11:02 ComputerSmiths

Hi, I have the same issue. Looks like some of the images have "LA" and "RGB" mode causing the issue (as they should be in RGBA mode for manipulating with them keeping transparency):

Here is the the full list of those problematic images which are not in RGBA mode:

/usr/local/lib/python3.7/site-packages/robohash # find . -name "*.png" | python -c "from PIL import Image; import sys; [print(f'{filename.strip()} - {Image.open(filename.s
trip())}') for filename in sys.stdin]" > /tmp/robohash_images
/usr/local/lib/python3.7/site-packages/robohash # cat /tmp/robohash_images | grep -v "mode=RGBA"
./sets/set5/005#FacialHair/FrecklesLight003.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679290>
./sets/set5/005#FacialHair/WrinkleTop.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679290>
./sets/set5/005#FacialHair/FrecklesLight004.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679310>
./sets/set5/005#FacialHair/FrecklesLight001.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679310>
./sets/set5/005#FacialHair/FrecklesLight002.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679310>
./sets/set5/005#FacialHair/Wrinkle.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679310>
./sets/set5/006#Top/WinterHat3-White.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679310>
./sets/set5/006#Top/WinterHat1-White.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679310>
./sets/set5/006#Top/WinterHat2-Brown.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679310>
./sets/set5/006#Top/WinterHat4-White.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679290>
./sets/set5/006#Top/WinterHat3-Brown.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679310>
./sets/set5/006#Top/WinterHat1-Gray01.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679290>
./sets/set5/006#Top/WinterHat2-Gray01.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679290>
./sets/set5/006#Top/LongHairBob-Pink.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679290>
./sets/set5/006#Top/WinterHat4-Brown.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679310>
./sets/set5/006#Top/WinterHat4-Gray01.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679310>
./sets/set5/006#Top/LongHairMiaWallace-Pink.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679310>
./sets/set5/006#Top/WinterHat1-Brown.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679290>
./sets/set5/006#Top/Blank.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679310>
./sets/set5/006#Top/WinterHat3-Gray01.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679310>
./sets/set5/006#Top/WinterHat2-White.png - <PIL.PngImagePlugin.PngImageFile image mode=LA size=1024x1024 at 0x7F61C6679310>
./backgrounds/bg2/005#robotBG-02.png - <PIL.PngImagePlugin.PngImageFile image mode=RGB size=300x300 at 0x7F61C6679310>
./backgrounds/bg2/001#robotBG-08.png - <PIL.PngImagePlugin.PngImageFile image mode=RGB size=300x300 at 0x7F61C6679290>
./backgrounds/bg2/000#robotBG-06.png - <PIL.PngImagePlugin.PngImageFile image mode=RGB size=300x300 at 0x7F61C6679310>
./backgrounds/bg2/002#robotBG-04.png - <PIL.PngImagePlugin.PngImageFile image mode=RGB size=300x300 at 0x7F61C6679290>
./backgrounds/bg2/003#robotBG-03.png - <PIL.PngImagePlugin.PngImageFile image mode=RGB size=300x300 at 0x7F61C6679310>
./backgrounds/bg2/004#robotBG-01.png - <PIL.PngImagePlugin.PngImageFile image mode=RGB size=300x300 at 0x7F61C6679290>
./backgrounds/bg2/006#robotBG-07.png - <PIL.PngImagePlugin.PngImageFile image mode=RGB size=300x300 at 0x7F61C6679310>
./backgrounds/bg1/012#robotBG-10.png - <PIL.PngImagePlugin.PngImageFile image mode=RGB size=300x300 at 0x7F61C6679310>
./backgrounds/bg1/007#final7.png - <PIL.PngImagePlugin.PngImageFile image mode=RGB size=350x350 at 0x7F61C6679290>
./backgrounds/bg1/006#final9.png - <PIL.PngImagePlugin.PngImageFile image mode=RGB size=350x350 at 0x7F61C6679310>
./backgrounds/bg1/000#robotBG-11.png - <PIL.PngImagePlugin.PngImageFile image mode=RGB size=300x300 at 0x7F61C6679290>
./backgrounds/bg1/003#final2.png - <PIL.PngImagePlugin.PngImageFile image mode=RGB size=350x350 at 0x7F61C6679310>
./backgrounds/bg1/010#final8.png - <PIL.PngImagePlugin.PngImageFile image mode=RGB size=350x350 at 0x7F61C6679310>
./backgrounds/bg1/001#robotBG-12.png - <PIL.PngImagePlugin.PngImageFile image mode=RGB size=300x300 at 0x7F61C6679290>
./backgrounds/bg1/002#final3.png - <PIL.PngImagePlugin.PngImageFile image mode=RGB size=350x350 at 0x7F61C6679310>
./backgrounds/bg1/009#final6.png - <PIL.PngImagePlugin.PngImageFile image mode=RGB size=350x350 at 0x7F61C6679290>
./backgrounds/bg1/005#final5.png - <PIL.PngImagePlugin.PngImageFile image mode=RGB size=350x350 at 0x7F61C6679310>
./backgrounds/bg1/004#final4.png - <PIL.PngImagePlugin.PngImageFile image mode=RGB size=350x350 at 0x7F61C6679290>

Details on the issue with RGBA: https://stackoverflow.com/questions/31273592/valueerror-bad-transparency-mask-when-pasting-one-image-onto-another-with-pyt

VladimirNT avatar Mar 11 '20 12:03 VladimirNT

Great catch, thanks!

e1ven avatar Mar 11 '20 18:03 e1ven

How tremendously embarrassing, my apologizes! I thought I had fixed this years ago, but it seems I had not. Fixed and merged. Thanks again to @VladimirNT for identifying the issue.

e1ven avatar Oct 21 '22 04:10 e1ven