Skip to content

Instantly share code, notes, and snippets.

@jindili
jindili / srgb2xyz.py
Created October 21, 2017 09:08 — forked from jcupitt/srgb2xyz.py
convert srgb to xyz
#!/usr/bin/python
import sys
R = int(sys.argv[1])
G = int(sys.argv[2])
B = int(sys.argv[3])
# assume RGB are 0 - 255 ... convert to 0 - 1
R /= 255.0
@jindili
jindili / andris2.py
Created October 21, 2017 09:08 — forked from jcupitt/andris2.py
render a set of PDFs using the new @n param
#!/usr/bin/env python
import sys
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
# this makes vips report peak mem use on exit
Vips.leak_set(True)
@jindili
jindili / andris.py
Created October 21, 2017 09:08 — forked from jcupitt/andris.py
assemble PDFs into a huge image
#!/usr/bin/env python
import sys
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
# this makes vips report peak mem use on exit
Vips.leak_set(True)
@jindili
jindili / snow.py
Created October 21, 2017 09:08 — forked from jcupitt/snow.py
#!/usr/bin/python
import sys
from gi.repository import Vips
snow = Vips.Image.new_from_file("SnowStorm.png")
bg = Vips.Image.new_from_file(sys.argv[1])
# stretch snow image to fit over background
@jindili
jindili / markus.py
Created October 21, 2017 09:08 — forked from jcupitt/markus.py
test big image assembly
#!/usr/bin/env python
import os
import numpy as np
import shutil
import tempfile
import itertools
import logging
import argparse
from gi.repository import Vips
@jindili
jindili / phone.py
Created October 21, 2017 09:08 — forked from jcupitt/phone.py
match phone numbers
#!/usr/bin/python
import csv
import sys
# we store a hash from name to list of phone numbers
name_table = {}
# for all command-line arguments
for filename in sys.argv[1:]:
@jindili
jindili / smartcrop3.py
Created October 21, 2017 09:08 — forked from jcupitt/smartcrop3.py
smartcrop with libvips
#!/usr/bin/python
# smartcrop with libvips, based very roughly on
# http://stackoverflow.com/a/1517178/894763
import sys
from gi.repository import Vips
image = Vips.Image.new_from_file(sys.argv[1])
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of the Z9 Slide Imaging & Analysis Platform.
# Copyright (C) 2015 Jonas Ogaard
#
# Z9 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of the Z9 Slide Imaging & Analysis Platform.
# Copyright (C) 2015 Jonas Ogaard
#
# Z9 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@jindili
jindili / smartcrop.py
Created October 21, 2017 09:08 — forked from jcupitt/smartcrop.py
smartcrop with Vips and Python
#!/usr/bin/python
# smartcrop with libvips, based very roughly on
# https://github.com/jwagner/smartcrop.js
import sys
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips