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.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4MDI0MjIsIm5iZiI6MTczODgwMjEyMiwicGF0aCI6Ii82NjE4ODIxNi8zMDM1NTYwNTUtMDE5ZTMyMTctMmZiMS00MTFlLThiNDctYTVjNWMwYmE0Yzg4LmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA2VDAwMzUyMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTZiODBkZGEyYjFiOGU0OTcxOWU2ZTRiNTMzMzk4OTdhMDRkOGE2NzcyZDZlNDFmOWViOWIxODhiNmExMjczOTImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.BT2bpFBgZV92iRprI94yU5EgmcqT0JcrCbUmdQs7JwE)
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.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4MDI0MjIsIm5iZiI6MTczODgwMjEyMiwicGF0aCI6Ii82NjE4ODIxNi8zMDM1NTYzNzctYTVjOGFmNzctN2I1ZC00YjkwLThlYTMtY2Q3ODZlZWRkOGZlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA2VDAwMzUyMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWJjMDJkMDFjMzZiMGM0ZmE1MjVkMzVjOWFiZDNhYzU2OTllYjM1YjRiMDIyN2ZhYzUxZmFjNDRiOTk0ZDBkZDYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.WWqMJgaUNsTxZsEhOnGSEb2-cQf745JlUwbcPTJ9r2o)
![test1](https://private-user-images.githubusercontent.com/66188216/303556392-4ba2f56a-f699-476d-a960-c053a74554e6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4MDI0MjIsIm5iZiI6MTczODgwMjEyMiwicGF0aCI6Ii82NjE4ODIxNi8zMDM1NTYzOTItNGJhMmY1NmEtZjY5OS00NzZkLWE5NjAtYzA1M2E3NDU1NGU2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA2VDAwMzUyMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWZjN2E4NTE0OTAxOWJkMTJmYTM2MTE0NzdiNDVhMzdkZjgxMTZjMWUyZDA0YmI3NzQ2MDFjMTkyOTVjYjNkNmImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.xXjbiX3cHmFnSVm76PRGlIodkMfP23-41vajMYNiZ0I)
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: