How can i convert a CMYK image to CMY

Can I please get a sample code in .Net to convert a CMYK image to CMY.
Thanks

Great question.

The PDF format specifically mentions CMY as one of the uses for the DeviceN colorspace. See Example 1 in Section 8.6.6.5 here: https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf

This forum post shows how to create a DeviceN colorspace.
https://groups.google.com/d/msg/pdfnet-sdk/oej6fRcFbyc/hx1rktuLeVIJ

Then you would create a new Image object, using one of the Image.Create methods, and then modify it to contain your custom data.Then, set the ColorSpace of the Image object to your DeviceN one.

Finally swapping the old image for the new, assuming the old image is not inline (inline images are rare), is trivial.
https://groups.google.com/d/msg/pdfnet-sdk/rI80ZziijfE/TzJ1Nq06g8oJ

Note, our Windows SDK includes a tool called COSEdit that you can use to see the internal contents of the PDF.