ai_v/venv/Lib/site-packages/PIL/PixarImagePlugin.py
24024 d4b28a731a feat(admin): 添加系统通知管理及前端通知显示功能
- 新增 SystemNotification 模型,实现系统通知的数据存储
- 管理后台新增通知相关接口,支持通知的增删改查
- 用户端新增接口,获取最新激活通知并支持标记已读
- 在前端首页添加全局通知弹窗,实现通知自动轮询及已读同步
- 生成历史记录中兼容支持图片缩略图及新旧图片格式
- 优化后台图片同步逻辑,新增缩略图生成与存储
- 支持上传参考图的拖拽、粘贴、多文件上传及排序功能
- 增加购买积分页面入口及菜单项,调整菜单结构
- 日志系统由 Redis 列表迁移为有序集合,保留 30 天日志
- 优化日志页面样式,提升可读性及滚动体验
- 调整部分模板布局为自定义滚动条容器,增强视觉一致性
2026-01-12 23:29:29 +08:00

73 lines
1.7 KiB
Python

#
# The Python Imaging Library.
# $Id$
#
# PIXAR raster support for PIL
#
# history:
# 97-01-29 fl Created
#
# notes:
# This is incomplete; it is based on a few samples created with
# Photoshop 2.5 and 3.0, and a summary description provided by
# Greg Coats <gcoats@labiris.er.usgs.gov>. Hopefully, "L" and
# "RGBA" support will be added in future versions.
#
# Copyright (c) Secret Labs AB 1997.
# Copyright (c) Fredrik Lundh 1997.
#
# See the README file for information on usage and redistribution.
#
from __future__ import annotations
from . import Image, ImageFile
from ._binary import i16le as i16
#
# helpers
def _accept(prefix: bytes) -> bool:
return prefix.startswith(b"\200\350\000\000")
##
# Image plugin for PIXAR raster images.
class PixarImageFile(ImageFile.ImageFile):
format = "PIXAR"
format_description = "PIXAR raster image"
def _open(self) -> None:
# assuming a 4-byte magic label
assert self.fp is not None
s = self.fp.read(4)
if not _accept(s):
msg = "not a PIXAR file"
raise SyntaxError(msg)
# read rest of header
s = s + self.fp.read(508)
self._size = i16(s, 418), i16(s, 416)
# get channel/depth descriptions
mode = i16(s, 424), i16(s, 426)
if mode == (14, 2):
self._mode = "RGB"
# FIXME: to be continued...
# create tile descriptor (assuming "dumped")
self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, 1024, self.mode)]
#
# --------------------------------------------------------------------
Image.register_open(PixarImageFile.format, PixarImageFile, _accept)
Image.register_extension(PixarImageFile.format, ".pxr")