using make to convert images to thumbs

Dave Johnson dave-gnhlug at davej.org
Sun Feb 26 12:54:00 EST 2006


Dave Johnson writes:
> Python writes:
> > I have a client that laid out their images and thumbs into almost
> > parallel directory structures.
> > 	/img		/thumb
> > 	  /x		  /img
> > 	    /y		    /x
> > 	      /*.jpg	      /y
> > 			        /*.jpg
> > 
> > x and y are two digit directory names used to shorten the directory
> > scans to retrieve files.  I thought I could use a Makefile to automate
> > the creation of thumbs, but this pattern has me stumped.
> > 
> > I am going to just write a script to step through the source tree and
> > check the corresponding time stamp unless someone offers a suggestion.
> > (No they will not shuffle things around because they have lots of logic
> > in place.)
> 
> 

slightly improved clean rule:

-- 
Dave


.DEFAULT: all
.DELETE_ON_ERROR:
.PHONY: all clean

IMAGES=$(wildcard img/*/*/*.jpg)
THUMBS=$(patsubst %,thumb/%,$(IMAGES))

all: $(THUMBS)

thumb/%: %
	@mkdir -p $(@D)
	convert $^ -scale 160x120 -quality 25 $@

clean:
	$(RM) -r thumb






More information about the gnhlug-discuss mailing list