Monday, September 29, 2014

Imagemagick annotate and animate

Anotate an image:

$convert in.jpg -fill white -pointsize 20  -annotate +20+30 'Blahblah' out.jpg

Make a looping gif of all jpg images in the current folder with 50 ms delay between frames:

$convert   -delay 50   -loop 0  *.jpg  my.gif


Tuesday, June 24, 2014

Makefile template

A makefile to be used as template. It automatically creates header dependencies using the -MMD flag of gcc so the user only needs to specify the source files. Libraries and compiler flags are generated using pkg-config.

CXXFLAGS =    -g  -I/usr/include/blah $(shell pkg-config --cflags thelib)
LIBS     = $(shell pkg-config --libs thelib) -lotherlib 
CXX      =  g++
SOURCES = source.cpp
OBJS = $(SOURCES:.cpp=.o)
DEPS = $(SOURCES:.cpp=.d)

TARGET =    a.out

$(TARGET):    $(OBJS)
    $(CXX) -o $(TARGET) $(OBJS) $(LIBS)
all:    $(TARGET)

%.o: %.cpp
    $(CXX) $(CXXFLAGS) -MMD -MP -c $< -o $@

clean:
    rm -f $(OBJS) $(TARGET) $(DEPS)

-include $(DEPS)