Created
September 13, 2009 09:06
-
-
Save qnighy/186130 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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