C#iTextSharp提取的CMYK图像以RGB格式返回 [英] C# iTextSharp Extracted CMYK images returns in RGB Format

查看:261
本文介绍了C#iTextSharp提取的CMYK图像以RGB格式返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用iTextsharp从电子纸PDF文件中提取图像,PDF文件中的图像为CMYK格式,但是提取的图像为RGB.请对此提出建议.预先感谢

I am using iTextsharp to extracted images from epaper PDF files, the images in the PDF files are in CMYK format, but the extracted images are in RGB. Please advice on this. Thanks in advance

int xrefIdx = ((PRIndirectReference)obj).Number;
PdfObject pdfObj = doc.GetPdfObject(xrefIdx);
PdfStream str = (PdfStream)pdfObj;
byte[] bytes = PdfReader.GetStreamBytesRaw((PRStream)str);

using (System.IO.MemoryStream memStream = new System.IO.MemoryStream(bytes))
{
var rawImage = System.Drawing.Image.FromStream(memStream); 
rawImage.Save(@"e:\extractedimages.jpeg", ImageFormat.Jpeg);
}

推荐答案

.NET不幸的是,.NET并不能真正满足您的需要,因为它只能在RGB中工作.请查看另一个问题的答案( https://stackoverflow.com/a/1773496/7122 ),该问题具有更多详细信息

Unfortunately, .NET isn't really up to the job for what you need to do as it really only works in RGB. Please see this answer to another question (https://stackoverflow.com/a/1773496/7122) which has more details.

这篇关于C#iTextSharp提取的CMYK图像以RGB格式返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆