13장. 스크립트
| 부 II. GIMP 마법사가 되려면? |

## 13장. 스크립트

## 1. 플러그인

### 1.1. 소개

김프의 멋진 점 중 하나는 플러그인을 통해 쉽게 기능확장을 할 수 있다라는 것입니다. 김프 플러그인은 김프 자체에 의해 제어되며 김프와 밀접하게 상호 동작하는 외부 프로그램입니다. 플러그인을 이용하면 사용할 수 있는 거의 모든 방법으로 이미지를 편집할 수 있습니다. 플러그인의 장점은 거대하고 복잡하기 짝이없는 김프 코어 코드를 고치지 않고, 작은 플러그인을 작성하는 것만으로 기능확장을 할 수 있다라는 점입니다. 많은 주요 플러그인들은 100-200 라인 정도의 C 언어로 작성되었습니다.

Several dozen plugins are included in the main GIMP distribution, and installed automatically along with GIMP. Most of them can be accessed through the Filters menu (in fact, everything in that menu is a plugin), but a number are located in other menus. In many cases you can use one without ever realizing that it is a plugin: for example, the "Normalize" function for automatic color correction is actually a plugin, although there is nothing about the way it works that would tell you this. Even importing and exporting of images is done by plugins.

Everyone can write a GIMP plugin and make it available online. There are many useful plugins that can be obtained this way. Some of them are described elsewhere in the User's Manual.

With this free availability comes a certain degree of risk. The fact that anyone can release plugins means that there is no effective quality control. The plugins distributed with GIMP have all been tested and tuned by the developers. Additional plugins available online, may have been hacked together in a few hours and then abandoned. Some plugin creators don't care about robustness, and even for those who do, their ability to test on a variety of systems in a variety of situations is often quite limited. Basically, when you download a plugin, you are getting something for free, and sometimes you get exactly what you pay for. This is not to discourage you, just to make sure you understand that not all plugins available online will deliver what you expect from them.

| 주의
Plugins, being full-fledged executable programs, can do all of the things that any other program can do. This includes installing back-doors on your system or otherwise compromise its security. Don't install a plugin unless it comes from a trusted source.

| 참고
Plugins written for a certain version of GIMP may not always work well in other versions. Though in general the GIMP team tries to minimize changes that affect plugins. Usually the only time you can expect serious problems with plugins, is when the major version of GIMP changes. When a plugin made for an older version doesn't work correctly anymore, it needs to be ported. Sometimes this is easy, sometimes not. Bottom line: before trying to install a plugin, make sure that it is compatible with your version of GIMP.

### 1.2. 플러그인 사용하기

대부분의 경우 플러그인이라는 것을 의식하지 않고도 김프의 다른 도구들처럼 플러그인을 사용할 수 있습니다. 하지만 플러그인의 속성에 대해 알아두면 조금더 편리하게 사용할 수 있습니다.

One is that plugins are generally not as robust as the GIMP core. When GIMP crashes, it is considered a very serious thing: it can cost the user a lot of trouble and headache. When a plugin crashes, the consequences are usually not as serious. In most cases you can continue working without worrying about it too much.

| 참고
Because plugins are separate programs, they communicate with GIMP in a special way: The GIMP developers call it “talking over a wire”. When a plugin crashes, the communication breaks down, and you may see an error message about a “wire read error”.

| 작은 정보
플러그인이 충돌하면, 김프는 해당 플러그인이 김프를 위험한 상태로 빠뜨릴 수 있다라는 무시무시한 경고 메세지를 보여줍니다. 그럴 경우에는 일단 이미지를 저장하고 김프를 종료하는 것이 좋습니다. 플러그인은 실제로 김프의 거의 모든 것을 바꿀 수 있지만, 일반적인 사용에 있어서 큰 문제가 되는 경우는 극히 드뭅니다. 따라서 대부분은 이에 대해 걱정하지 않고 작업을 계속해도 무방합니다. 이런 문제가 발생했을 경우에는 그 심각성이 어느 정도인지를 판단한 뒤 그에 맞게 조치하는 것이 좋습니다.

Because of the way plugins communicate with GIMP, they do not have any mechanism for being informed about changes you make to an image after the plugin has been started. If you start a plugin, and then alter the image using some other tool, the plugin may crash. Even if it doesn't, doing this may cause incorrect results. You should avoid running more than one plugin at a time on an image, and avoid doing anything to the image until the plugin has finished working on it. If you ignore this advice, not only could you screw up the image, you may also screw up the undo system, so that you won't be able to recover from your mistake.

### 1.3. 새 플러그인 설치하기

The plugins that are distributed with GIMP don't require installation. Plugins that you download yourself do. Usually the default location is in GIMP's user directory in a folder under `/plug-ins`, where the folder name needs to be the same as the plugin filename. You can find the default locations where GIMP searches for plugins in GIMP's folder preferences. There you can also add new locations where GIMP should look for plug-ins. There are several scenarios, depending on what OS you are using and how the plugin is structured.

#### 1.3.1. Linux / Unix-like systems

대부분의 플러그인은 두 가지로 분류할 수 있습니다. 하나는 .c 파일의 소스 코드 형태로 배포되는 소수의 플러그인들이고, 다른 하나는 `Makefile` 을 포함한 많은 파일과 디렉토리를 가진 형태로 배포되는 대부분의 플러그인입니다.

For a simple one-file plugin, call it `borker.c`, installing it is just a matter of running the command gimptool-2.0 --install borker.c. This command compiles the plugin and installs it in your personal plugin directory, `~/gimp-2.10/plug-ins` unless you have changed it. This will cause it to be loaded automatically the next time you start GIMP. You don't need to be root to do these things; in fact, you shouldn't be. If the plugin fails to compile, well, be creative.

#### 1.3.2. 창

Most GIMP plugins available on Windows supply either an installer, or can be downloaded in a pre-compiled binary format ready to copy to a folder of your choice that is recognized by GIMP.

If an installer is available, that should do all the work for you selecting an appropriate folder and copying all relevant files. If not, you may have to check in GIMP's folder preferences where the plugins should be copied to. Remember, each plugin needs to be in its own folder with the same name as the plugin.

#### 1.3.3. 애플 맥 OS X(Apple Mac OS X)

How you install plugins on OS X mostly depends on how you installed GIMP itself. If you were one of the brave and installed GIMP through one of the package managers like fink [FINK] or darwinports [DARWINPORTS], the plugin installation works exactly the way it is described for the Linux platform already. The only difference is, that a couple of plugins might be even available in the repository of your package manager, so give it a try.

If, on the other hand, you prefer to grab a prebuilt GIMP package like GIMP.app, you most likely want to a prebuilt plugin too. You can try to get a prebuilt version of the plugin of your dreams from the author of the plugin. Building your own binaries unfortunately involves installing GIMP.

#### 1.3.4. Running the installed plugin

Once you have installed the plugin, how do you activate it? The menu path is determined by the plugin itself, so to answer this you need to either look at the documentation for the plugin (if there is any), explore the menus, or use GIMP's command search function by pressing / and then entering the name of the plugin. If you know how to read source code you could also check that to see in what menu it registers itself.

For more complex plugins, organized as a directory with multiple files, there usually is a file inside called either `INSTALL` or `README`, with instructions. If not, the best advice is to toss the plugin in the trash and spend your time on something else: any code written with so little concern for the user is likely to be frustrating in myriad ways.

If you install a plugin in your personal plugin directory that has the same name as one in the system plugin directory, only one can be loaded, and it will be the one in your home directory. You will receive messages telling you this each time you start GIMP. This is probably a situation best avoided.

### 1.4. 플러그인 작성하기

플러그인을 작성하는 법을 배우고 싶다면, 김프 개발자 사이트인 [GIMP-DEV-PLUGIN] 에서 많은 도움을 얻을 수 있을 것입니다. 김프는 복잡한 프로그램이지만 개발팀의 노력으로 쉽게 플러그인을 작성할 수 있게 되었습니다. 많은 과정안내와 예제가 있고, 플러그인들에 사용되는 주요 라이브러리(“libgimp”)는 문서화가 잘된 API 를 가지고 있으므로, 기존의 플러그인을 수정해 사용해본 프로그래머라면 곧 익숙해질 것입니다.

6. 초기 화면 변경하기 |  | 2. Script-Fu 스크립트 사용하기

Report a bug in GIMP Report a documentation error