Skip to content

Commit

Permalink
support progressive JPEG
Browse files Browse the repository at this point in the history
  • Loading branch information
a523 committed Oct 22, 2021
1 parent 7572911 commit 6dbd8d3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions preview_generator/preview/builder/image__wand.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import typing

from wand.image import Image as WImage
from wand.image import Image
import wand.version
from wand.color import Color

Expand Down Expand Up @@ -60,13 +60,14 @@ def build_jpeg_preview(
size = self.default_size
preview_name = preview_name + extension
dest_path = os.path.join(cache_path, preview_name)
with WImage(filename=file_path) as img:
with Image(filename=file_path) as img:
# https://legacy.imagemagick.org/Usage/thumbnails/
img.auto_orient()
img.background_color = Color("white")
img.merge_layers("flatten")
img.strip()
img.sample()
img.interlace_scheme = "plane"
if img.width < size.width and img.height < size.height:
flag = "<"
else:
Expand Down

0 comments on commit 6dbd8d3

Please sign in to comment.