(data)
| 174 | |
| 175 | @staticmethod |
| 176 | def GetPictureSize(data): |
| 177 | if not data: |
| 178 | return 0, 0, "jpg", False |
| 179 | try: |
| 180 | from PIL import Image |
| 181 | from io import BytesIO |
| 182 | a = BytesIO(data) |
| 183 | img = Image.open(a) |
| 184 | isAnima = getattr(img, "is_animated", False) |
| 185 | if img.format == "PNG": |
| 186 | mat = "png" |
| 187 | elif img.format == "GIF": |
| 188 | mat = "gif" |
| 189 | elif img.format == "WEBP": |
| 190 | mat = "webp" |
| 191 | else: |
| 192 | mat = "jpg" |
| 193 | a.close() |
| 194 | return img.width, img.height, mat, isAnima |
| 195 | except Exception as es: |
| 196 | Log.Error(es) |
| 197 | return 0, 0, "jpg", False |
| 198 | |
| 199 | # @staticmethod |
| 200 | # def GetLookModel(category): |
no test coverage detected