-
I get blurry images in PDF when making them smaller and fitting to the PDF page in the center.
If I remove the I have attached demo images and outputs, the output.pdf has centered but blurry images, the output-no-resize-no-extend.pdf has perfect quality images as I need the to images are no longer centered on the PDF page. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
When you resize the image you will make it smaller. When you want the best quality image you should only var fromPageSize = MagickGeometry.FromPageSize("a4");
var width = image.Width / (double)fromPageSize.Width;
var height = image.Height / (double)fromPageSize.Height;
var max = Math.Max(width, height);
var newWidth = (int)(fromPageSize.Width * max);
var newHeight = (int)(fromPageSize.Height * max);
image.Extent(newWidth, newHeight, Gravity.Center); |
Beta Was this translation helpful? Give feedback.
When you resize the image you will make it smaller. When you want the best quality image you should only
Extent
the image. You should calculate what the width and height should be to have the same aspect ratio as the page size. You can calculate that with the following method (there might be a better method to do this):