Skip to content

Instantly share code, notes, and snippets.

(vips) john@banana ~/pics/jxl $ vips --version
vips-8.16.0
(vips) john@banana ~/pics/jxl $ vipsheader -a jxl-layers-e7.jxl
jxl-layers-e7.jxl: 490x490 uchar, 4 bands, srgb, jxlload
width: 490
height: 490
bands: 4
format: uchar
coding: none
interpretation: srgb
@jcupitt
jcupitt / userChrome.css
Created May 6, 2024 16:29
userChrome.css for firefox wth tree style tabs
#main-window[tabsintitlebar="true"]:not([extradragspace="true"]) #TabsToolbar
> .toolbar-items {
opacity: 0;
pointer-events: none;
}
#main-window:not([tabsintitlebar="true"]) #TabsToolbar {
visibility: collapse !important;
}
#sidebar-header {
display: none;
@jcupitt
jcupitt / colourdeconv.py
Created September 9, 2023 12:43
colour deconvolution with pyvips
#!/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]
@jcupitt
jcupitt / fetch-vs-crop.py
Created March 30, 2023 10:38
time fetch and crop for image read
#!/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")
@jcupitt
jcupitt / createtiff.c
Created December 10, 2022 12:40
make a multipage tiff file
/* compile with
*
* gcc -Wall createtiff.c `pkg-config libtiff --cflags --libs`
*/
#include <tiffio.h>
int
main (int argc, const char **argv)
{
/*
* add-profile.c ... paste an ICC profile into a JPG file, without
* decompress/recompress.
*
* Adapted from wrjpgcom.c
*
* compile with:
*
* gcc -g -Wall add-profile.c `pkg-config glib-2.0 --cflags --libs`
*/
You'd think __callStatic() would fire, but I see:
$ ./static.php
calling try_static_call in object context
calling try_static_call in object context
calling try_static_call in object context
calling try_static_call in object context
calling try_method_call in object context
$ php --version
@jcupitt
jcupitt / try1.cs
Created December 20, 2021 17:00
convert netvips to bitmap and back
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
using var image = NetVips.Image.NewFromFile(args[0]);
// make a System.Drawing bitmap from it
using var bitmap = NetVips.Extensions.BitmapConverter.ToBitmap(image);
@jcupitt
jcupitt / userChrome.css
Created December 6, 2021 17:55
user chrome for tree-style tabs
#main-window[tabsintitlebar="true"]:not([extradragspace="true"]) #TabsToolbar
> .toolbar-items {
opacity: 0;
pointer-events: none;
}
#main-window:not([tabsintitlebar="true"]) #TabsToolbar {
visibility: collapse !important;
}
#sidebar-header {
display: none;
@jcupitt
jcupitt / bounce.js
Created February 3, 2021 21:25
bouncy balls
let numBalls = 13;
let spring = 1.01;
let balls = [];
function setup() {
createCanvas(720, 400);
for (let i = 0; i < numBalls; i++) {
balls[i] = new Ball(
random(width),
random(height),