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/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 |
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/python | |
# untile a dzsave --layout google level | |
# tiles are expected to be named as ARG/y/x.jpg, so use as: | |
# | |
# untile-google.py ~/pics/somepyramid/4 out.jpg | |
# | |
# to make out.jpg, level 4 of somepyramid reassembled | |
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/python3 | |
# untile a dzsave --layout dz level | |
# tiles are expected to be named as ARG/x_y.jpeg, so use as: | |
# | |
# untile-dz.py ~/pics/somepyramid_files/11 out.jpg | |
# | |
# to make out.jpg, level 4 of somepyramid reassembled |
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/python3 | |
import sys | |
import pyvips | |
from numpy import linalg | |
stain = [ | |
[0.468, 0.023, 0.767], | |
[0.721, 0.141, 0.576], | |
[0.511, 0.990, 0.284] |
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 ruby | |
# "trim" is nnow built in, so this is easy | |
require 'vips' | |
im = Vips::Image.new_from_file(ARGV[0]) | |
left, top, width, height = im.find_trim | |
im = im.crop(left, top, width, height) |
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/python3 | |
import random | |
import time | |
import sys | |
import pyvips | |
if len(sys.argv) != 4: | |
print("usage: ./fetch-vs-crop.py IMAGE SIZE N-TILES") |
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
import pyvips | |
# rotate an image with centre crop and reflection fill | |
im = pyvips.Image.new_from_file("/home/john/pics/k2.jpg") | |
# pyvips rotate always fills any new pixels which appear around the image edges | |
# with 0 (black). To have something else in there, we need to expand the image | |
# first, then crop it down to just the bit we need. |
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
/* vips8 introspection demo | |
* | |
* compile with: | |
* | |
* gcc -g -Wall introspect.c `pkg-config vips --cflags --libs` | |
* | |
* try: | |
* | |
* ./a.out embed | |
* |
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/python | |
import sys | |
from gi.repository import Vips | |
N_BINS = 10 | |
BIN_SIZE = 256 / N_BINS | |
im = Vips.Image.new_from_file(sys.argv[1], access = Vips.Access.SEQUENTIAL) |
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
/* compile with | |
* | |
* gcc -Wall createtiff.c `pkg-config libtiff --cflags --libs` | |
*/ | |
#include <tiffio.h> | |
int | |
main (int argc, const char **argv) | |
{ |
NewerOlder