Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for #693 #706

Merged
merged 11 commits into from
Feb 23, 2023
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ This can also be enabled programmatically with `warnings.simplefilter('default',
### Changed
- vector images parsing is now more robust: `fpdf2` can now embed SVG files without `viewPort` or no `height` / `width`
- bitonal images are now encoded using `CCITTFaxDecode`, reducing their size in the PDF document - thanks to @eroux
- when possible, JPG and group4 encoded TIFFs are now embedded directly without recompression - thanks to @eroux

## [2.6.1] - 2023-01-13
### Added
Expand Down
10 changes: 5 additions & 5 deletions fpdf/fpdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3716,9 +3716,7 @@ def preload_image(self, name, dims=None):
if info:
info["usages"] += 1
else:
if not img:
img = load_image(name)
info = ImageInfo(get_img_info(img, self.image_filter, dims))
info = ImageInfo(get_img_info(name, img, self.image_filter, dims))
info["i"] = len(self.images) + 1
info["usages"] = 1
self.images[name] = info
Expand Down Expand Up @@ -3836,7 +3834,7 @@ def _downscale_image(self, name, img, info, w, h):
# The existing low-res image is too small, we need a bigger low-res image:
info.update(
get_img_info(
img or load_image(name), self.image_filter, dims
name, img or load_image(name), self.image_filter, dims
)
)
LOGGER.debug(
Expand All @@ -3848,7 +3846,9 @@ def _downscale_image(self, name, img, info, w, h):
info["usages"] += 1
else:
info = ImageInfo(
get_img_info(img or load_image(name), self.image_filter, dims)
get_img_info(
name, img or load_image(name), self.image_filter, dims
)
)
info["i"] = len(self.images) + 1
info["usages"] = 1
Expand Down
Loading