【问题标题】:iOS -- Conversion of PDF results in saturation of colorsiOS——PDF转换导致颜色饱和
【发布时间】:2013-10-03 07:05:03
【问题描述】:

我们正在构建 iOS 应用程序,我们将在其中将 pdf 转换为 png,然后显示 png。 PDF到Png的转换一切都很好。但是颜色的饱和度有些问题。

我还尝试直接在 Safari 中打开 pdf,但会导致相同的颜色饱和度问题。有没有办法控制 PDF 的颜色?

以下是pdf页面转换成图片的代码:

CGRect cropBox = CGPDFPageGetBoxRect(page, kCGPDFCropBox);
int pageRotation = CGPDFPageGetRotationAngle(page);

if ((pageRotation == 0) || (pageRotation == 180) ||(pageRotation == -180)) {
    UIGraphicsBeginImageContextWithOptions(cropBox.size, NO, resolution / 72); 
}
else {
    UIGraphicsBeginImageContextWithOptions(CGSizeMake(cropBox.size.height, cropBox.size.width), NO, resolution / 72); 
}

CGContextRef imageContext = UIGraphicsGetCurrentContext();   

[PDFPageRenderer renderPage:page inContext:imageContext];

UIImage *pageImage = UIGraphicsGetImageFromCurrentImageContext();   

UIGraphicsEndImageContext();

【问题讨论】:

    标签: iphone ios pdf core-graphics


    【解决方案1】:

    此时,您无能为力。可能您的 PDF 文件包含 CMYK 图像,而 iOS 不包含经过设备校准的 CMYK 配置文件,因此当 CMYK 转换为 RGB 时,颜色看起来完全不同。

    【讨论】:

    • 有没有其他方法可以控制它?或者是否有任何适用于 linux 的工具可以将 CMYK pdf 转换为 RGB pdf?
    • 解决方法是将 CMYK pdf 转换为 RGB pdf。 Ghostscript 可能会完成这项工作,但我不确定。
    • 我们尝试了 GhostScript,但是将 pdf 转换为 RGB 兼容的 PDF 会导致转换非常缓慢。 IT 在一分钟内转换大约 3 页。我们可以快速转换的任何其他方式。我们也知道pdf是基于JPX的pdf。这是 iOS 支持的吗?
    猜你喜欢
    • 1970-01-01
    • 2016-09-25
    • 2013-10-10
    • 2011-05-17
    • 2012-10-30
    • 2022-12-30
    • 2011-01-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多