Skip to content

Instantly share code, notes, and snippets.

@qnighy
Created September 13, 2009 09:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qnighy/186130 to your computer and use it in GitHub Desktop.
Save qnighy/186130 to your computer and use it in GitHub Desktop.
#!/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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment