Is it possible to render to a CMYK image format without any intermediate conversion steps?
Asked on behalf of this questioner:
Is it possible to render to a CMYK image format without any intermediate conversion steps?
Asked on behalf of this questioner:
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.)
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()