oreilly.comSafari Books Online.Conferences.


CinePaint: The GIMP Goes Hollywood

by Howard Wen

Making it big in Hollywood is tough, but moviemaking professionals have readily accepted CinePaint in the past few years. This image retouching program is a reworking of an unmaintained spin-off of The GIMP, the open source world's alternative to Photoshop.

On the code level, while CinePaint retains roots to The GIMP, it has evolved along a different path. For example, a major studio has contributed code for a new image core called img_img. That developed as a command-line tool similar in purpose to ImageMagick's convert. The CinePaint developers want to replace the tile-based GIMP-derived core with this new, high-performance raster-based engine designed for use on studio render farms. This change will also bring a new channel architecture that supports CMYK, RGBAZ, and any other image structure desired.

The team is currently adding vector paint features. Unlike raster paint — that behaves like spray paint — vector-based geometric figures can be picked up and modified after being drawn. There's already a PowerPoint-like slideshow mode that shows off vector-based slides, but the main purpose of vector paint is to improve rotoscoping capabilities in CinePaint. Rotoscoping is a spline-based special effects painting technique used for effects such as the light sabers in Star Wars. Vector paint will give CinePaint the capability to create similar effects easily.

The architecture and feature-set of CinePaint continues to evolve to meet the particular needs of a specific niche of users: image editors and special effects artists working in motion picture film, a medium which requires a high degree of image fidelity. Beyond that core market, the team also adds features necessary for professional printing, another market The GIMP doesn't serve.

Learning Lab TigerLinux/Unix System Administration Certification -- Would you like to polish your system administration skills online and receive credit from the University of Illinois? Learn how to administer Linux/Unix systems and gain real experience with a root access account. The four-course series covers the Unix file system, networking, Unix services, and scripting. It's all at the O'Reilly Learning Lab.

Effects artists have used it to clean and touch up footage for major, special-effects-filled Hollywood studio movies that include The Last Samurai, Elf, and 2 Fast 2 Furious. In February, the studio Flash Film Works won the Visual Effects Society Award for Best Supporting Feature Film Effects for The Last Samurai. Part of the work Flash Film Works did on that movie was to add flying arrows to the battle scenes using CinePaint.

CinePaint started as a development version of The GIMP, sponsored by the film industry in 1998. The GIMP evolved in a different direction, though, and The GIMP team abandoned the code to languish in CVS. As an example of what CinePaint developers call the "Lazarus effect," useful open source projects never need to die. Though Film GIMP never saw a public release, the current CinePaint team came together, resurrecting and renaming the project. Development continues to this day.

Robin Rowe, the project leader, became involved in reviving Film GIMP when he researched and wrote a Linux Journal article about Film GIMP use by a special effects company. The 43-year-old Hollywood programmer consults for the movie studios and also leads the Linux Movies Group, a user group for those who work with (or anyone interested in) Linux-based motion picture technology.

Because building Film GIMP from the CVS was difficult, Rowe decided to help out when readers of his article asked for a source tarball or RPM files. The GIMP development team did not publicly support Film GIMP as a priority, so Rowe "suggested putting the tarball up myself, and everyone agreed that could be best."

From there, Film GIMP finally made its official launch on, fittingly enough, American Independence Day — July 4, 2002. Then other developers came out of the woodwork: Sam Richards, an employee at Sony Pictures Imageworks, emailed Rowe and revealed that his company had been using Film GIMP for a year. Not only that, they had fixed and improved the application, and were willing to contribute their work to the official code base.

Giving The GIMP More Depth

The technical demands of motion picture and high-resolution photography tax or exceed the capabilities of either The GIMP or Photoshop. Photo retouching applications, including The GIMP and Photoshop, deal with 8-bit color images, and the latest version of Photoshop has good 16-bit capabilities. CinePaint, though, supports 8-bit, 16-bit, and 32-bit depths. Artists refer to the ability to manipulate color images of a broader range as "deep paint."

O'Reilly Open Source Convention.

When it comes to motion picture color, "bits" differ from standard computer images: it's bits per channel, not per pixel. So a 24-bit RGB monitor is only an 8-bit device, and 16-bit color is the equivalent of a 48-bit RGB. "Motion picture film, and now theatrical digital projection, is capable of displaying 16-bits per channel of color. Monitor technology is not," says Rowe.

Color depth at the 32-bit range is more than the human eye can discern — at least, with current display devices, but he explains: "As with Hi-Fi audio, the point of so much 'excessive' quality is 'headroom.' When manipulating imagery, you want to have room to maneuver — not have to worry that your content will degrade perceptibly as you are working on it."

Photographers and publishers also benefit from the depth of CinePaint. "This is an important prerequisite to avoid artifacts in printed output. Catalogs can show more exactly what they represent. The human eye gets more stimulated by meaningful colors," says Kai-Uwe Behrmann, a 35-year-old programmer from Chemnitz, Germany. To bring the visual qualities of deep paint to high-resolution still photography, he ported the Gimp-Print utility to CinePaint so that it could handle 16-bit colors internally. The result is that printed photos under CinePaint exhibit smoother shading and higher contrast.

Threads, not Forks

Thus far, the languages and libraries used in CinePaint have mostly come from The GIMP code. It's written in C and C++, and uses the typical image file format libraries, including LibTIFF and Independent JPEG Group. It also supports the open source OpenEXR format, developed by ILM for motion picture work.

Also, like The GIMP, it currently uses GTK+ for its GUI library. This has proved problematic on Windows, where GTK 1 does not work well. The current plan is to replace GTK with FLTK, building a compatibility layer to ease migration. Their initial experiments seem promising, but the developers have no schedule estimates in mind.

The CinePaint developers have updated the embedded Scheme interpreter, Script-Fu, and have added Python support. Java support is in the works.

"We're trying to strike out in a little different direction on embedded languages from GIMP because we have different goals, particularly with performance," says Rowe. "The GIMP plugin architecture is slow, but that isn't an issue for them because by our standards the typical GIMP web image is very small — say, 100K. A typical motion picture image is much larger — 1828x1102 and weighs in at 12MB. And that isn't just one image. A motion picture has 150,000 of them. Launching a new process and shuttling the pixels down a pipe as GIMP does isn't a very fast way to apply, for instance, a blur filter."

Therefore, the CinePaint plugin architecture uses threads rather than forks, resulting in plugins that work faster and scripting languages that can manipulate image rasters directly. To accomplish this, the CinePaint developers have had to recompile The GIMP plugins for CinePaint and "trick" them into running. "We have a plugin compatibility layer (PICL) that shims GIMP plugin code as-is into the CinePaint architecture," says Rowe.

This threaded processing runs only on the Windows version of CinePaint presently — for its other platform versions, CinePaint still uses the original The GIMP plugin system. "We compile identical plugin code to thread or fork depending on platform. We will be bringing threaded plugins to Mac and Linux, too. When that's ready, we'll throw a switch and recompile. It is backwards compatible," Rowe assures.

This meticulous approach enabled the CinePaint team to port the PIC image format plugin from The GIMP. Except for fixing some minor bugs, the code needed no changes to build under CinePaint as a threaded plugin.

Tailor-made for the Movies

The CinePaint team is developing new image file formats specifically for their application. For example, CPX will replace "the mutant version of GIMP XCF we inherited," says Rowe. "CPX is interesting because it has text tags and binary blobs. Unlike typical image formats, CPX is self-documenting."

While CinePaint is usable for low-level image manipulation, its developers remain committed to keeping their focus on its particular user niche.

"CinePaint was originally going to be the development path The GIMP project was going to take. We picked it up. Any changes we have made, and will continue to make, are based on what is best for our target audience, the motion picture studio artists," says Andrew Prock, another key CinePaint developer.

Pages: 1, 2

Next Pagearrow

Linux Online Certification

Linux/Unix System Administration Certificate Series
Linux/Unix System Administration Certificate Series — This course series targets both beginning and intermediate Linux/Unix users who want to acquire advanced system administration skills, and to back those skills up with a Certificate from the University of Illinois Office of Continuing Education.

Enroll today!

Linux Resources
  • Linux Online
  • The Linux FAQ
  • Linux Kernel Archives
  • Kernel Traffic

  • Sponsored by: