Render crop and optimized variants next to the thumbnail
The worker decodes the original once (JPEG draft down to the optimized box, EXIF orientation applied in place, alpha composed on white) and encodes three variants: the 256 px thumbnail, a centred 128x128 JPEG crop that may upscale and a WebP fitted into 1280x1280 without upscaling, quality 80, method 4. No EXIF, ICC or XMP is written. The byte limit is checked before decoding. ready is set by the transaction that stores all three rows, so a partial set is never published. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
045d631c12
commit
431b82fd43
@@ -39,7 +39,11 @@ from messenger.attachments.application.queries import GetAttachment, OpenAttachm
|
||||
from messenger.attachments.config import AttachmentsSettings, PipelineSettings
|
||||
from messenger.attachments.domain.jobs import RetryPolicy
|
||||
from messenger.attachments.infrastructure.faults import EnvironmentFaults
|
||||
from messenger.attachments.infrastructure.images import PillowImageInspector, PillowVariantRenderer
|
||||
from messenger.attachments.infrastructure.images import (
|
||||
PillowImageInspector,
|
||||
PillowVariantRenderer,
|
||||
RenderLimits,
|
||||
)
|
||||
from messenger.attachments.infrastructure.postgres import (
|
||||
PostgresAttachmentDirectory,
|
||||
PostgresAttachmentsUnitOfWork,
|
||||
@@ -170,7 +174,8 @@ class PipelineProvider(Provider):
|
||||
class WorkerProvider(Provider):
|
||||
@provide(scope=Scope.APP)
|
||||
def renderer(self, settings: PipelineSettings) -> VariantRenderer:
|
||||
return PillowVariantRenderer(settings.max_image_pixels, settings.worker_concurrency)
|
||||
limits = RenderLimits(settings.max_upload_bytes, settings.max_image_pixels)
|
||||
return PillowVariantRenderer(limits, settings.worker_concurrency)
|
||||
|
||||
@provide(scope=Scope.APP)
|
||||
def faults(self, settings: PipelineSettings, logger: Logger) -> Faults:
|
||||
|
||||
Reference in New Issue
Block a user