Skip to content

Commit

Permalink
Fix the error where GIF file thumbnails could not be created properly
Browse files Browse the repository at this point in the history
  • Loading branch information
pk5ls20 committed Jun 22, 2024
1 parent f6c9d85 commit 9d67899
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/Services/upload_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async def _upload_task(self, img_data: ImageData, img_bytes: bytes, skip_ocr: bo
logger.info("Start generate and upload thumbnail for {}.", img_data.id)
img.thumbnail((256, 256), resample=Image.Resampling.LANCZOS)
img_byte_arr = BytesIO()
img.save(img_byte_arr, 'WebP')
img.save(img_byte_arr, 'WebP', save_all=True)
await self._storage_service.active_storage.upload(img_byte_arr.getvalue(), thumb_path)
logger.success("Thumbnail for {} generated and uploaded!", img_data.id)

Expand Down
2 changes: 1 addition & 1 deletion scripts/local_create_thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async def main():
# generate thumbnail max size 256*256
img.thumbnail((256, 256))
img_byte_arr = io.BytesIO()
img.save(img_byte_arr, 'WebP')
img.save(img_byte_arr, 'WebP', save_all=True)
await services.storage_service.active_storage.upload(img_byte_arr.getvalue(),
f'thumbnails/{str(image_id)}.webp')
logger.success("Thumbnail for {} generated!", image_id)
Expand Down

0 comments on commit 9d67899

Please sign in to comment.