3
$\begingroup$

Is it possible to render to a CMYK image format without any intermediate conversion steps?


Asked on behalf of this questioner:

$\endgroup$
0

2 Answers 2

7
$\begingroup$

CMYK is a device-dependent color model. This means essentially that if we don't know the device where color will be reproduced, the values expressed in this model are meanlingless, as they aren't enough to provide any colour accuracy.

RGB is also a device-dependent color model.

In theory, both RGB and CMYK images should be always tagged with their corresponding colorspace definitions (usually in the shape of icc profiles) to tell our software's color management whether a colorspace conversion is needed to ensure the proper color rendition.

For practical reasons and to a certain extent because images for the web need to be small, it is commonly assumed that an RGB image without an embedded profile is in the sRGB colorspace. However, there isn't such assumption for CMYK files: They have to be tagged properly, otherwise you can't know the device where they are supposed to be printed.

To make things even worse, the "device" in this case doesn't only mean the machine where the piece will be printed, but also the type of paper, inks, setup, etc. that will be used for printing. This means that there's no such thing as "CMYK" if you don't specify "which CMYK", so producing a proper CMYK file from any software requires to know a few things about how the image will be printed.

Failing to anticipate those things will most likely cause you and your printer a lot of troubles and cost you a lot of money, so it's not something you want to take lightly.

In desktop publishing ICC Color Management takes care of these aspects as long as files are tagged properly with ICC profiles. But Blender, as most of the 3D and VFX programs, doesn't support ICC profiles.

So first problem: Blender can't deal with ICCs, so the conversion has to be done externally.

Apart from that, producing CMYK colors from an RGB original is a destructive and irreversible process where a part of the RGB gamut (the non-printable colors) are lost irremediably. For that reason, CMYK is not a very good model for editing if preserving quality and color accuracy is your goal. Converting to CMYK is something you want to do at the very end of your creative process, when everything else is done.

It may feel tempting to skip a step and move to CMYK as soon as possible, but it ends up being a terrible idea as your files will be only good for a single printed output, they will be heavier in size and they will need to be converted back to RGB for any non-printed output, with the huge drawback of having lost a big chunk of their color latitude.

So yes, it is sort of possible to save CMYK right away from Blender with a script like the one proposed here, but it's not really a good idea. It's more sensible to save your renders in the maximum quality and color fidelity possible (RGB from blender with no further conversions) and adopt a good workflow where the separation to CMYK is done properly with the right tools and at the right moment. Imagemagick (the tool used for the addon proposed in the other answer) has the facilities for converting to CMYK properly, but it's advisable to perform the conversion on an already saved high quality RGB file taking care of all the parameters required for printed output (size and resolution, colorspace conversion and embedding, file format, etc.)

$\endgroup$
10
  • 2
    $\begingroup$ I really feel like this is a non-answer. $\endgroup$
    – Matt
    Commented Nov 23, 2016 at 14:38
  • $\begingroup$ If CMYK is device dependent just like RGB, then converting blindly to CMYK will be at least as good as blindly using RGB without knowing which monitor your image will be on. If we don't have to know which monitor is on the other end of the web, and that's more-or-less okay, then converting to CMYK will at least get us in the neighborhood of the right colors for printing, even if we don't know the printer and paper. Sure, there's a whole "print-making" science, but if the asker were interested in that level of precision, they would ask their coworkers... not us. $\endgroup$
    – Matt
    Commented Nov 23, 2016 at 14:38
  • $\begingroup$ The real answer is "No, Blender doesn't know how to convert from RGB to CMYK. You'll have to use a different tool." $\endgroup$
    – Matt
    Commented Nov 23, 2016 at 14:40
  • $\begingroup$ @Matt: No, you're wrong. A blind conversion from RGB to CMYK is nowhere near to what printed colours are going to be. If you choose to ignore colour management completely you're going to produce garbage from your print output. It's not a matter of "level of precision", it's just getting a good print vs. getting useless crap. $\endgroup$
    – Gez
    Commented Nov 24, 2016 at 1:26
  • $\begingroup$ Want a simple example? Let's say you don't care about colour spaces so you're going to take any sRGB* image and do a blind separation to an undefined CMYK. Let's make the RGB image cyan. That's, in that colour model 100% blue and 100% green. 0,255,255 or #00FFFF Let's say we do that "Blind" conversion, where we don't care about colorspaces, just take RGB cyan and make it CMYK cyan. Go print that Cyan in ANY printer out there. See what you get. See what you wanted. Again It's not matter of precision. Different models, different primaries. Ignore that and your printed output will suck. $\endgroup$
    – Gez
    Commented Nov 24, 2016 at 1:32
4
$\begingroup$

No, this feature isn't supported by Blender.

preface: as mentioned in @Gez answer, its likely you won't actually want to do some automated conversion from RGB to CMYK, however... there may be some situations where an automated conversion makes sense and can be tweaked to fit your needs, in that case, this answer may be useful to you.


Using an add-on and ImageMagick, this can be automated.

ImageMagick will need to be installed and the command convert will need to be in your path.

Save this file as render_cmyk.py and install it via Blenders's add-on preferences.

Once installed, the render output panel will have a checkbox to write out CMYK images along side the image format your rendering to.

When rendering an animation it will create a CMYK version of images written to disk.

If you need to use ICC profiles, these can be passed as arguments too,
see ImageMagick's documentation.

bl_info = {
    "name": "Render CMYK",
    "version": (1, 0),
    "blender": (2, 77, 0),
    "location": "Render Properties -> Output",
    "description": "Converts an image to CMYK when saving out animation renders",
    "warning": "",
    "wiki_url": "",
    "category": "Render",
    }

# defines the format used to write to (tiff/psd/jpg... etc)
FORMAT_EXT = "tiff"

import bpy
from bpy.props import BoolProperty
from bl_ui.properties_render import RENDER_PT_output
from bpy.app.handlers import persistent

@persistent
def render_write_cmyk(scene):
    import os
    import subprocess

    if scene.use_render_cmyk:
        filepath_src = scene.render.frame_path()
        filepath_dst = os.path.splitext(filepath_src)[0] + "." + FORMAT_EXT
        if os.path.exists(filepath_src):
            cmd = (
                "convert",
                filepath_src,
                "-colorspace", "cmyk",
                filepath_dst,
                )
            print("Running:", " ".join(cmd))
            subprocess.check_call(cmd)
        else:
            print("File not found for conversion %r" % filepath_src)


def draw(self, context):
    layout = self.layout
    layout.prop(context.scene, "use_render_cmyk")


def register():
    bpy.types.Scene.use_render_cmyk = BoolProperty(name="Write CMYK")
    RENDER_PT_output.append(draw)
    bpy.app.handlers.render_write.append(render_write_cmyk)


def unregister():
    del bpy.types.Scene.use_render_cmyk
    RENDER_PT_output.remove(draw)
    bpy.app.handlers.render_write.remove(render_write_cmyk)

if __name__ == "__main__":
    register()
$\endgroup$
10
  • 1
    $\begingroup$ This excercise is pointless and I'm sure there's a better use for your time and efforts. First of all: PSD is not a format suitable for printing, it's intended for editing in Photoshop. So, if this file is intended to go to Photoshop anyway, why bothering? you can do the conversion in Photoshop. Heck, you can even do it with GIMP and the Separate+ plugin. Nobody who knows a thing about printing would need this, and most certainly wouldn't have any troubles converting a proper RGB from Blender to CMYK using the appropriate tool for the task. CMYK has no place in a program like Blender. $\endgroup$
    – Gez
    Commented Apr 18, 2016 at 23:21
  • 1
    $\begingroup$ CMYK is device dependent, and unlike RGB where untagged is usually assumed to be sRGB, a CMYK file without a colorspace definition is meaningless (and potentially dangerous if it's sent to print). Also, CMYK makes sense for process printing (offset presses, for instance) and it has little use in any printer that contains a driver taking care of the separations itself (any inkjet, laser, plotter, etc.) unless you really know what you're doing. And even in that case, the way you prepare a file for print (marks, resolution, etc.) is out of the scope of Blender. $\endgroup$
    – Gez
    Commented Apr 18, 2016 at 23:27
  • $\begingroup$ This add-on can be used with color profiles, so its not preventing you from using device dependent settings. And agree this is out of scope for Blender, thats why it can be done as an add-on. If someone wants to pass arguments for DPI, page size... etc. They can avoid having to handle this in an external program. $\endgroup$
    – ideasman42
    Commented Apr 19, 2016 at 2:51
  • $\begingroup$ Made this write tiff images by default, can be modified easily. $\endgroup$
    – ideasman42
    Commented Apr 19, 2016 at 3:09
  • 1
    $\begingroup$ No, exactly the opposite: Both are perfectly capable of producing correct results. The reporter said that he wasn't able to produce a good separation with Photoshop*. I was pointing out that if that was the case, he won't be able to produce a good separation (according to his expectations) with Imagemagick either, as both PS and IM do basically the same. *) This was what the reported said: "For my business, I normally need to convert every project into CMYK for print and that is where the colors of the RGB jpg are really screwed up and I spend hours recoloring my entire Blender creation." $\endgroup$
    – Gez
    Commented Apr 19, 2016 at 22:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .