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

New Post: Possible bug with large file streams?

$
0
0
Using this image: https://www.dropbox.com/s/hvgfu4f6s25zhqu/PreviewforTif.tif. It's large(191 MB)
       var destinationStream = new FileStream("test.pdf", FileMode.Create);

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

        MagickImage magickImage1 = new MagickImage(sourceFilePath);

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

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

       //if I stop right here, I get a .pdf at 300 dpi.  Perfect.  but as I continue...

        destinationStream.Seek(0, SeekOrigin.Begin);
        MagickImage magickImageDestination = new MagickImage(destinationStream);

        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)
        {

        }
Here I end up with a .pdf that is sometimes corrupted. It's also only like 8 mb, which can't be right. And if it's not corrupted, it's only 72 dpi.

Let me know if you need more information or if I am missing something.

Thanks, Tim

Viewing all articles
Browse latest Browse all 3693

Trending Articles



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