Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: ImageMagic (mogrify) and Magick.NET - JPG is edged instead rounded (AdaptiveResize)

$
0
0
How to convert pdf to resized jpg without using ghostscript?
using (var inputStream = File.OpenRead(inputFile))
{
    using (var outputStream = File.OpenWrite(outputFile))
    {
        using (var memoryStream = new MemoryStream())
        {
            MagickReadSettings settings = new MagickReadSettings();
            settings.Density = new MagickGeometry(300);
            settings.FrameIndex = 0;
            settings.FrameCount = 1;
            settings.Format = MagickFormat.Pdf;

            using (MagickImage image = new MagickImage(inputStream, settings))
            {
                image.Quality = 100;
                image.Write(memoryStream, MagickFormat.Jpg);
            }

            if (memoryStream.CanSeek) { memoryStream.Seek(0, System.IO.SeekOrigin.Begin); }
            settings.Format = MagickFormat.Jpg;
            using (MagickImage image = new MagickImage(memoryStream, settings))
            {
                image.Quality = 100;
                image.Resize(115, 0);
                image.Write(outputStream, MagickFormat.Jpg);
            }
        }
    }
}

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>