Skip to content

Instantly share code, notes, and snippets.

@jcupitt
jcupitt / introspect.c
Last active August 29, 2015 13:55
simple vips8 introspection example
/* vips8 introspection demo
*
* compile with:
*
* gcc -g -Wall introspect.c `pkg-config vips --cflags --libs`
*
* This example needs vips 7.39 or later.
*
* try:
*
@jcupitt
jcupitt / profile.c
Created February 15, 2014 10:00
icc profiles across vips operations
Sample output. Everything is ref-counted, so the profile sticks around across the cast.
$ ./a.out ~/pics/shark2.jpg x.jpg
profile: 3048 bytes at 0x1321350
profile: sRGB IEC61966-2-1 black scaled
profile: 3048 bytes at 0x1321350
profile: sRGB IEC61966-2-1 black scaled
memory: high-water mark 4.15 MB
$
@jcupitt
jcupitt / try88.c
Last active August 29, 2015 13:56
test load jpeg from buffer
/* test the load jpeg from memory path in vips
*
* compile with:
*
* gcc -g -Wall try88.c `pkg-config vips --cflags --libs`
*
* test with:
*
* export G_DEBUG=gc-friendly
* export G_SLICE=always-malloc
/* Compile with
gcc -Wall rawsave.c `pkg-config vips --cflags --libs`
*/
#include <vips/vips.h>
int
main( int argc, char **argv )
@jcupitt
jcupitt / gsf.c
Created April 18, 2014 12:03
create an uncompressed zip file using libgsf
/* test gsf zip write
*
* compile with:
*
* gcc -g -Wall gsf.c $(pkg-config libgsf-1 --cflags --libs)
*/
#include <stdio.h>
#include <string.h>
@jcupitt
jcupitt / gsf-bench.c
Last active August 29, 2015 14:01
benchmark libgsf zip read
/* Benchmark random reading from a zip file with libgsf.
*
* Compile with
*
* gcc gsf-bench.c `pkg-config libgsf-1 --cflags --libs`
*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
@jcupitt
jcupitt / gsf-bench2.c
Created May 20, 2014 16:21
faster gsf benchmark
/* Benchmark random reading from a zip file with libgsf.
*
* Compile with
*
* gcc gsf-bench2.c `pkg-config libgsf-1 --cflags --libs`
*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
/* Benchmark random reading from a zip file with libgsf.
*
* Compile with
*
* gcc -g -Wall gsf-bench3.c `pkg-config libgsf-1 --cflags --libs`
*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
@jcupitt
jcupitt / try214.c
Created May 30, 2014 09:16
test vips_gaussblur
/* test vips_gaussblur()
*
* compile with:
*
* gcc -g -Wall try214.c `pkg-config vips --cflags --libs`
*
* test with:
*
* valgrind --db-attach=yes ./a.out 100 ~/pics/babe.tif x.tif
*/
@jcupitt
jcupitt / copy-stream.c
Last active August 29, 2015 14:02
test vips copy between streams
/* test load/save with streams
*
* compile with:
*
* gcc -g -Wall copy-stream.c `pkg-config vips --cflags --libs`
*
* test with:
*
* cat ~/pics/k2.jpg ~/pics/k4.jpg | ./a.out | cat > x
*/