You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as I can tell, this is occurring because of the optimization in #7568 depending on a delta image which, when disposal is 2, can have been generated with a background image that is filled with a color with a palette index that does not exist in the frame's palette, presumably creating a nonsense delta.
Moving these lines of code outside the if statement seems to fix the issue, presumably due to _get_background having a side effect of placing the appropriate color into the frame's palette with the same index as in the background.
This does not occur when disposal is set to any other value or when optimize is set to False due to skipping one or both of the codepaths involved in the bug.
The text was updated successfully, but these errors were encountered:
Can confirm that PR fixes it, probably the best solution since a delta with a solid color, unchanging background isnt gonna be less data than the original frame.
What did you do?
Created a sequence of images with jittering text and saved them as a gif, specifying
disposal=2
What did you expect to happen?
The gif to correctly display the images, with a consistent background
What actually happened?
The background flashes between opaque and transparent, with which frames are which depending on how exactly the text is jittering
![testout](https://private-user-images.githubusercontent.com/66188216/303556055-019e3217-2fb1-411e-8b47-a5c5c0ba4c88.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU1NDg0NTgsIm5iZiI6MTcyNTU0ODE1OCwicGF0aCI6Ii82NjE4ODIxNi8zMDM1NTYwNTUtMDE5ZTMyMTctMmZiMS00MTFlLThiNDctYTVjNWMwYmE0Yzg4LmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA1VDE0NTU1OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWZmNmY5NWE2NWVmNzcxNDNhNTA0YWUwOGI4Y2MzNTk2Y2Y0NTBhNzM0ODYzN2QyODU4YWE1MmIyOTIwM2ViNjYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0._oGkfJcJEm6_0v4M74iGma2BhfrN3NQ8SAOqgspfyXc)
What are your OS, Python and Pillow versions?
This code with these images was used to generate the above gif:
test0.png:
![test0](https://private-user-images.githubusercontent.com/66188216/303556377-a5c8af77-7b5d-4b90-8ea3-cd786eedd8fe.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU1NDg0NTgsIm5iZiI6MTcyNTU0ODE1OCwicGF0aCI6Ii82NjE4ODIxNi8zMDM1NTYzNzctYTVjOGFmNzctN2I1ZC00YjkwLThlYTMtY2Q3ODZlZWRkOGZlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA1VDE0NTU1OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJjOTEwZWE3OWZhMDc0MDhlYTJlNzE3ZmJlZjkzZDcxZTAyMmI1MzI2MWNmYWUxMjAzZTRkNjU1ZmRlZThiNzEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.S7RUlrNwByzWMjTTH9hWTidDs1NBUY676OR4O1qiXO4)
![test1](https://private-user-images.githubusercontent.com/66188216/303556392-4ba2f56a-f699-476d-a960-c053a74554e6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU1NDg0NTgsIm5iZiI6MTcyNTU0ODE1OCwicGF0aCI6Ii82NjE4ODIxNi8zMDM1NTYzOTItNGJhMmY1NmEtZjY5OS00NzZkLWE5NjAtYzA1M2E3NDU1NGU2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA1VDE0NTU1OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM5OTY4NDZiYzJkNWVjMDJiZTQyOGY4YjE0MzU4YmI0ZWVkMjk4NTcwMDQyYWUyZTEzYmRiNGViMWQ2YmRmZjgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.qW4mbAdmTBBSJdHZjr84z4A-ZO2Cj3SSDUwuIeBOWh4)
test1.png:
As far as I can tell, this is occurring because of the optimization in #7568 depending on a delta image which, when
disposal
is 2, can have been generated with a background image that is filled with a color with a palette index that does not exist in the frame's palette, presumably creating a nonsense delta.Moving these lines of code outside the if statement seems to fix the issue, presumably due to
_get_background
having a side effect of placing the appropriate color into the frame's palette with the same index as in the background.This does not occur when
disposal
is set to any other value or whenoptimize
is set toFalse
due to skipping one or both of the codepaths involved in the bug.The text was updated successfully, but these errors were encountered: