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

New Post: Possible bug with large file streams?

$
0
0
You're code snippet above seems to work for pdf's. But I'm having a similar problem converting to .png. They all end up being 72 DPI.

Using this image: https://www.dropbox.com/s/k7khbpvbrqqtryz/22307_009_%20JM_0055.jpg
    var destinationStream = new FileStream("test.png", FileMode.Create);

    //this is the image in dropbox
    string sourceFilePath = jpgFile;

    MagickImage magickImage1 = new MagickImage(sourceFilePath);

    magickImage1.Strip();
    magickImage1.Format = MagickFormat.Png;
    magickImage1.Density = new MagickGeometry(300, 300);

    destinationStream.SetLength(0);
    magickImage1.Write(destinationStream);

    destinationStream.Seek(0, SeekOrigin.Begin);
    MagickReadSettings settings = new MagickReadSettings();
    settings.Density = new MagickGeometry(300, 300);
    settings.Format = MagickFormat.Png;
    MagickImage magickImageDestination = new MagickImage(destinationStream, settings);

    MagickImage magickImageSource = new MagickImage(sourceFilePath);

    ColorProfile cp = magickImageSource.GetColorProfile();

    if (cp != null)
    {
        magickImageDestination.AddProfile(cp);
    }

    destinationStream.SetLength(0);

     try
    {
        magickImageDestination.Write(destinationStream);
    }
    catch (Exception e)
    {

    }

Viewing all articles
Browse latest Browse all 3693

Trending Articles



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