This project has moved and is read-only. For the latest updates, please go here.

How to resize PDF converted to JPEG

Apr 11, 2014 at 10:07 PM
I need to resize an PDF converted to a JPEG which is converted to a Base64 using the method ToBase64()

I tried the following but didn't work
Dim settings As New MagickReadSettings()
     settings.Density = New MagickGeometry(400, 400)
     settings.Width = 800
     settings.Height = 600

Using image As New MagickImage(file.InputStream, settings)
          image.Format = MagickFormat.Jpeg
          imgString = image.ToBase64()
          image.Write(Server.MapPath("../Scan/") & imgString)
End Using
The image is being saved but not in the correct size

Apr 12, 2014 at 6:41 AM
Specifying the size of the image in MagickReadSettings does not automatically resize it. It is a setting for images that don't have predefined dimensions. You will have to call the Resize method.
image.Format = MagickFormat.Jpeg
image.Resize(800, 600)
imgString = image.ToBase64()