Python枕头/PIL库gif损坏问题

问题描述

我正在尝试使用 python 枕头库创建一个 gif,但我遇到了一个问题。在代码将图像转换为 gif 后,我的 gif 上会出现绿点。往下看可以看得更清楚。 (您需要使 gif 全屏才能看到它。corrupted gif)。此外,这是第一帧。first proper frame

这是我使用的代码

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:layout_centerHorizontal="true"
    tools:context=".fragments.login.Login"
    android:id="@+id/fragmentLogin">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/clLogin"
        android:layout_width="match_parent"
        android:layout_height="match_parent">


        <ImageView
            android:id="@+id/login_logo"
            android:layout_width="320dp"
            android:layout_height="354dp"
            android:layout_gravity="center"
            android:layout_marginTop="16dp"
            android:src="@drawable/login_logo"
            app:layout_constraintHorizontal_bias="0.494"
            app:layout_constraintLeft_toLeftOf="@id/clLogin"
            app:layout_constraintRight_toRightOf="@id/clLogin"
            app:layout_constraintTop_toTopOf="@id/clLogin"
            tools:ignore="ContentDescription" />

        <com.google.android.material.textfield.TextInputEditText
            app:layout_constraintTop_toBottomOf="@+id/login_logo"
            android:id="@+id/login_username"
            android:layout_width="286dp"
            android:layout_height="53dp"
            android:ems="15"
            android:hint="Username"
            android:inputType="text"
            android:textSize="20sp"
            tools:ignore="HardcodedText"
            app:layout_constraintLeft_toLeftOf="@+id/clLogin"
            app:layout_constraintRight_toRightOf="@+id/clLogin"
            tools:layout_editor_absoluteX="62dp"
            tools:layout_editor_absoluteY="361dp"
            android:layout_marginTop="5dp"
            />

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/login_password"
            app:layout_constraintTop_toBottomOf="@+id/login_username"
            app:layout_constraintLeft_toLeftOf="@+id/login_username"
            app:layout_constraintRight_toRightOf="@+id/login_username"
            android:layout_width="286dp"
            android:layout_height="53dp"
            android:ems="15"
            android:hint="Password"
            android:inputType="text"
            android:textSize="20sp"
            tools:layout_editor_absoluteX="62dp"
            tools:layout_editor_absoluteY="428dp"
            tools:ignore="HardcodedText"
            android:layout_marginTop="5dp"
            />

        <androidx.appcompat.widget.AppCompatButton
            android:id="@+id/login_button"
            app:layout_constraintTop_toBottomOf="@+id/login_password"
            app:layout_constraintLeft_toLeftOf="@+id/login_password"
            app:layout_constraintRight_toRightOf="@+id/login_password"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Login"
            tools:ignore="HardcodedText,PxUsage"
            tools:layout_editor_absoluteX="149dp"
            tools:layout_editor_absoluteY="507dp"
            android:layout_marginTop="5dp"
            />

        <androidx.appcompat.widget.AppCompatButton
            android:id="@+id/login_sign_up_button"
            app:layout_constraintTop_toBottomOf="@+id/login_button"
            app:layout_constraintLeft_toLeftOf="@+id/login_button"
            app:layout_constraintRight_toRightOf="@+id/login_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Sign up"
            tools:ignore="HardcodedText"
            tools:layout_editor_absoluteX="149dp"
            tools:layout_editor_absoluteY="507dp"
            android:layout_marginTop="5dp"
            />

        <androidx.appcompat.widget.AppCompatButton
            android:id="@+id/login_guest_button"
            app:layout_constraintTop_toBottomOf="@id/login_sign_up_button"
            app:layout_constraintLeft_toLeftOf="@+id/login_sign_up_button"
            app:layout_constraintRight_toRightOf="@+id/login_sign_up_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="Continue as guest"
            tools:ignore="HardcodedText"
            tools:layout_editor_absoluteX="114dp"
            android:layout_marginTop="5dp"
            />
    </androidx.constraintlayout.widget.ConstraintLayout>
    <View
        android:id="@+id/view"
        android:layout_width="0dp"
        android:layout_height="0dp"
        tools:layout_constraintRight_toRightOf="parent"
        tools:layout_constraintTop_toTopOf="parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>


  [2]: https://i.stack.imgur.com/LzFEZ.png

我是 Python 的初学者。所以,如果你能详细解释一下,我将不胜感激。

如果你能帮助我,我会很高兴!谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)