MCPcopy Index your code
hub / github.com/python-pillow/Pillow / load

Method load

src/PIL/IcnsImagePlugin.py:294–315  ·  view source on GitHub ↗
(self, scale: int | None = None)

Source from the content-addressed store, hash-verified

292 raise ValueError(msg)
293
294 def load(self, scale: int | None = None) -> Image.core.PixelAccess | None:
295 if scale is not None:
296 width, height = self.size[:2]
297 self.size = width * scale, height * scale
298 self.best_size = width, height, scale
299
300 px = Image.Image.load(self)
301 if self._im is not None and self.im.size == self.size:
302 # Already loaded
303 return px
304 self.load_prepare()
305 # This is likely NOT the best way to do it, but whatever.
306 im = self.icns.getimage(self.best_size)
307
308 # If this is a PNG or JPEG 2000, it won't be loaded yet
309 px = im.load()
310
311 self.im = im.im
312 self._mode = im.mode
313 self.size = im.size
314
315 return px
316
317
318def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None:

Callers

nothing calls this directly

Calls 2

load_prepareMethod · 0.45
getimageMethod · 0.45

Tested by

no test coverage detected