LinuxでCanonのMP810からスキャンした画像を修正するGIMPプラグイン

CanonのMP810のスキャナは何故か公式のソフトでスキャンできないのでSANE経由でスキャンするんだけど、

スキャンした画像がRGBチャンネルごとになんかズレてでてくる。

なのでそれを修正するプラグイン。これを~/gimp-2.6/plug-insに突っこんで実行属性つけてスキャンしてフィルタメニューからこれを選んで修正する。


qnighy's
gist: 186130 — Gist

#!/usr/bin/env python
# mp810.py
# Fixes your image imported by Canon MP810, Linux, SANE
# using GIMP's Python-fu.
# Throw it to ~/.gimp-2.6/plug-ins directory, make it executable,
# import image, and select "Filters"->"Generic"->"MP810 Scanner fix" menu.

import math
from gimpfu import *

def python_mp810(timg, tdrawable):
    yshift = int(round(timg.resolution[1]/50))
    dimg = pdb.plug_in_decompose(timg, tdrawable, "RGB", 1)[0]
    dimg.layers[0].translate(0,-yshift)
    dimg.layers[2].translate(0,yshift)
    dimg.layers[0].resize_to_image_size()
    dimg.layers[2].resize_to_image_size()
    pdb.plug_in_recompose(dimg, dimg.active_drawable)
    gimp.delete(dimg)

register(
        "mp810",
        "mp810 scanner fix",
        "mp810 scanner fix",
        "Masaki Hara",
        "Masaki Hara",
        "2009",
        "<Image>/Filters/Generic/MP_810 Scanner fix",
        "RGB*",
        [
        ],
        [],
        python_mp810)

main()