문제

I am using the following command:

convert sourcefile.pdf -profile "cmyk.icc" -profile "srgb.icc" +profile "*" output.pdf

On a test 3MB file, it creates a 20MB PDF that is horrible quality.

If I add in a -density 600 parameter, the file explodes to over 600mb. Is there any way to convert the color space while maintaining everything else? It's a temporary PDF for further processing, so I don't need it to be exact same size, but I can't deal with giant PDF file sizes.

도움이 되었습니까?

해결책

Your problem is not the use of the color profiles with convert and ImageMagick.

I guarantee you'd have the very same problem with these commands:

convert  sourcefile.pdf  output.pdf 

convert  -density 600  sourcefile.pdf  output.pdf 

Your real problem is to use ImageMagick for a task where it is not good at. Because ImageMagick cannot deal itself with PDFs. It can only deal with raster images. This is where it excels and where it's really really good at.

Because PDFs are not raster images (though they can contain these), ImageMagick uses a delegate to convert the PDF pages into single full-page images. This delegate is Ghostscript.

Only after receiving the delegate's result (the raster image), ImageMagick starts to work in your profile changes. Once it's done, it converts the image back to PDF -- but now the PDF has lost all its former vector objects, and from each page there's only a pixelized version left.

Just like you can't put the meat back into one single piece once you've grinded it through the meat mincer -- you can't get back the original PDF objects (vector drawings, fonts, etc.) once you've rasterized its pages like ImageMagick does....


The solution for your problem (messing with color profiles used by PDFs): Use the right tool for the job. Learn to use Ghostscript directly! (Because Ghostscript can embed ICC color profiles into PDFs without changing the pages to raster images first. You don't need ImageMagick for this!)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top