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

Same output for different inputs

Mar 20, 2016 at 11:42 PM
Edited Mar 20, 2016 at 11:51 PM
I am trying to create a function that will accept many file types but output a transparent PNG.
So far I have this bit of code:
public async Task<string> ConvertImage(byte[] data, bool replaceBlack)

    // Create our read settings
    var settings = new MagickReadSettings()
        Width = 600,
        Height = 600

    // Create our image
    using (var image = new MagickImage())

        // Set the background as transparent before we read it
        image.Settings.BackgroundColor = MagickColors.Transparent;
        image.Read(data, settings);

        // Create a new memory stream
        using (var memoryStream = new MemoryStream())

            // Set to a png
            image.Format = MagickFormat.Png32;

            // Write to our stream

            // Reset the memory stream position
            memoryStream.Position = 0;

            // Create a new blob block to hold our image
            var blockBlob = container.GetBlockBlobReference(Guid.NewGuid().ToString() + ".png");

            // Upload to azure
            await blockBlob.UploadFromStreamAsync(memoryStream);

            // Return the blobs url
            return blockBlob.StorageUri.PrimaryUri.ToString();
which is working perfectly with svg files, but when I try a png or ai file I just get a full transparent image.
Does anyone know why?
Mar 24, 2016 at 9:13 PM
Can you add a sample png/ai file that I can use to reproduce this issue? A link to a file on something like DropBox would be great.