-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Modify Wand builder and replace Imagemagick and Pillow with it
* modify image__wand builder so that it is like common thumbnail generation strategies * deprecate Pillow and ImageMagick (command line) builder * add doc about how to enable eps format support PR ref: #274 issue ref: #253
- Loading branch information
Showing
20 changed files
with
271 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import os | ||
from PIL import Image | ||
from preview_generator.preview.builder.image__wand import ImagePreviewBuilderWand | ||
from preview_generator.preview.builder.image__imconvert import ImagePreviewBuilderIMConvert | ||
from preview_generator.utils import ImgDims | ||
|
||
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
CACHE_DIR = "/tmp/preview-generator-tests/cache" | ||
|
||
|
||
def test_build_jpeg_preview() -> None: | ||
wand_builder = ImagePreviewBuilderWand() | ||
test_orient_path = os.path.join(CURRENT_DIR, "the_img.png") | ||
extension = ".jpg" | ||
preview_name = "preview_the_img" | ||
width = 512 | ||
height = 256 | ||
size = ImgDims(width=width, height=height) | ||
wand_builder.build_jpeg_preview( | ||
file_path=test_orient_path, | ||
preview_name=preview_name, | ||
cache_path=CACHE_DIR, | ||
page_id=-1, | ||
size=size, | ||
extension=extension | ||
) | ||
preview_name = preview_name + extension | ||
dest_path = os.path.join(CACHE_DIR, preview_name) | ||
assert os.path.exists(dest_path) | ||
assert os.path.getsize(dest_path) > 0 | ||
with Image.open(dest_path) as jpg: | ||
assert jpg.height == height | ||
assert jpg.width in range(288, 290) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Oops, something went wrong.