MCPcopy
hub / github.com/tonquer/JMComic-qt / GetPictureSize

Method GetPictureSize

src/tools/tool.py:176–197  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

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):

Callers 10

Waifu2xPictureMethod · 0.80
RunMethod · 0.80
UpdatePictureMethod · 0.80
CheckToQImageMethod · 0.80
AddCovertDataMethod · 0.80
Waifu2xCancleMethod · 0.80
SetDataMethod · 0.80
SetWaifuDataMethod · 0.80
ShowImgMethod · 0.80
__call__Method · 0.80

Calls 2

ErrorMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected