You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Read first frame of gif imageusing(varimage=newMagickImage("c:\path\to\Snakeware.gif")){// Save frame as jpgimage.Write("c:\path\to\Snakeware.jpg");}// Write to streamvarsettings=newMagickReadSettings();// Tells the xc: reader the image to create should be 800x600settings.Width=800;settings.Height=600;using(varmemStream=newMemoryStream()){// Create image that is completely purple and 800x600using(varimage=newMagickImage("xc:purple",settings)){// Sets the output format to pngimage.Format=MagickFormat.Png;// Write the image to the memorystreamimage.Write(memStream);}}// Read image from fileusing(varimage=newMagickImage("c:\path\to\Snakeware.png")){// Sets the output format to jpegimage.Format=MagickFormat.Jpeg;// Create byte array that contains a jpeg filebyte[]data=image.ToByteArray();}
Convert CMYK to RGB
// Uses sRGB.icm, eps/pdf produce better result when you set this before loading.varsettings=newMagickReadSettings();settings.ColorSpace=ColorSpace.sRGB;// Create empty image using(varimage=newMagickImage()){// Reads the eps image, the specified settings tell Ghostscript to create an sRGB imageimage.Read("c:\path\to\Snakeware.eps",settings);// Save image as tiffimage.Write("c:\path\to\Snakeware.tiff");}// Read image from fileusing(varimage=newMagickImage("c:\path\to\Snakeware.jpg")){// Will use the CMYK profile if the image does not contain a color profile.// The second profile will transform the colorspace from CMYK to RGBimage.TransformColorSpace(ColorProfile.USWebCoatedSWOP,ColorProfile.SRGB);// Save image as pngimage.Write("c:\path\to\Snakeware.png");}// Use custom color profileusing(varimage=newMagickImage("c:\path\to\Snakeware.jpg")){// Will use the CMYK profile if your image does not contain a color profile.// The second profile will transform the colorspace from your custom icc profileimage.TransformColorSpace(ColorProfile.USWebCoatedSWOP,newColorProfile("YourProfile.icc"));// Save image as tiffimage.Write("c:\path\to\Snakeware.tiff");}