English 中文(简体)
What s the best way to convert a .eps (CMYK) to a .jpg (RGB) with Image Magick
原标题:

I have a bunch of .eps files (CMYK) that I need to convert to .jpg (RGB) files.

The following command sometimes gives me under or over saturated .jpg images, when compared to the source EPS file:

    $cmd = "convert -density 300 -quality 100% -colorspace RGB ".$epsURL." -flatten -strip ".$convertedURL; 

Is there a smarter way to do this such that the converted image will have the same qualities as the source EPS file?

Here is an example of the source file info:

Image: rejm.eps Format: PS (PostScript) Class: DirectClass Geometry: 537x471 Base geometry: 1074x941 Type: ColorSeparation Endianess: Undefined Colorspace: CMYK Channel depth: Cyan: 8-bit Magenta: 8-bit Yellow: 8-bit Black: 8-bit Channel statistics: Cyan: Min: 0 (0) Max: 255 (1) Mean: 161.913 (0.634955) Standard deviation: 72.8257 (0.285591) Magenta: Min: 0 (0) Max: 255 (1) Mean: 184.261 (0.722591) Standard deviation: 75.7933 (0.297229) Yellow: Min: 0 (0) Max: 255 (1) Mean: 70.6607 (0.277101) Standard deviation: 39.8677 (0.156344) Black: Min: 0 (0) Max: 195 (0.764706) Mean: 34.4382 (0.135052) Standard deviation: 38.1863 (0.14975) Total ink density: 292% Colors: 210489 Rendering intent: Undefined Resolution: 28.35x28.35 Units: PixelsPerCentimeter Filesize: 997.727kb Interlace: None Background color: white Border color: #DFDFDFDFDFDF Matte color: grey74 Page geometry: 537x471+0+0 Dispose: Undefined Iterations: 0 Compression: Undefined Orientation: Undefined Signature: 8ea00688cb5ae496812125e8a5aea40b0f0e69c9b49b2dc4eb028b22f76f2964 Profile-iptc: 19738 bytes

Thanks

最佳回答

Is there a good reason your output files are in JPEG format? EPS is a vector format, while JPEG is a lossy-compression bitmap format which is specifically optimized for photographs - i.e., images consisting of vaguely defined patches of variable color, as opposed to sharply defined solid areas, which is what vector images consist of.

So in converting (rasterizing) from any vector format to JPEG, you are basically guaranteed to get ugly edge artifacts and blotchy patches in what are supposed to be solid blocks of color. This will happen no matter what you do; it is inherent to the JPEG format. The way to minimize this is setting the compression to zero, but then you are getting none of the benefits and basically have no reason to be using JPEG.

Non-lossy bitmap formats like PNG, which is supported by all web browsers, are much better; they can give you solid colors and cleaner edges.

If it s someone else who is specifying the JPEG format for this project, I implore you to please, please, explain this to that person. Unfortunately the vast majority of people do not understand this very basic fact about the JPEG format, and only know that JPEG is the "default" bitmap format, so the web is full of misapplied horrible-quaility JPEG bitmap images - from corporate logos of multimillion-dollar corporations to work by so-called professional graphic designers.

If by chance your source EPS files have bitmap images embedded in them, and what you re trying to do is extract them, rather than rasterize vector data, I m pretty sure the "ps2image" type of tools in Ghostscript will do the job instead.

问题回答

An .eps file is a vector file format.

A .jpg is bitmap file format.

The .eps file is rendered to a bitmap which is then compressed using JPEG compression and saved to a .JPG file.

The issue you are running into is that CMYK is designed for device output. Thus you will need to apply an appropriate ICC profile using Little CMS or PhotoShop/PhotoPaint. The appropriate profile depends on the output device. If, for example you are displaying the result on your monitor, you will need to use an your monitors ICC profile. If you are outputing the result to your office printer then you will need to use your office printer s ICC profile. Lower end devices typically do not come with an ICC profile, however, you might be able to download one for your device from the Internet. Image manipulation software like Photoshop or PhotoPaint do come with a selection of profiles that can be used.

You could try something like this, though I m not sure if this will work or is correct. See the ImageMagick documentation for further help.

convert cmyk_image.eps -profile sRGB.icc rgb_image.jpg




相关问题
phpThumb cannot find ImageMagick / Imagick

I m having a problem with phpThumb. It says in the documentation that to get the best out of it, use ImageMagick / Imagick. I ve got this installed on the Server (running Centos 5.1), and can run ...

Properly converting a CMYK image to RGB with RMagick

I have been using the below to do a color conversion if @image.colorspace == Magick::CMYKColorspace # @image.colorspace #=> CMYKColorspace=12 @image.colorspace = Magick::...

Imagemagick convert pdf to png

I am rather new to using the command line and php. That being said I have been trying to figure out how to use ImageMagick with the exec() function. I have this currently, $command="/usr/local/lib/...

ImageMagick failing to convert to JPG

We recently installed the latest version of ImageMagick onto our Linux server. I seem to be having issues performing the most basic of tasks. I am running this command line: /usr/bin/convert /...

热门标签