SlideShare a Scribd company logo
1 of 6
Download to read offline
Makefiles for
Automating
Image Processing
Shweta Sadawarte
CEO Nelkinda Software Craft Pvt Ltd
Problem
● Scale a large set (200+) of images to a
target resolution.
● Target resolution might change due to
website redesign -> scaling has to be
repeated
● Image set might change - new images might
be added later.
Solution
● Automatable image processing using
NetPBM
● Automation using GNU make
Why to use make?
● Having a set of input files that shall be
transformed to a set of output files according
to certain rules is the nature of make.
● The make program uses timestamp to
decide which of the files need to be updated.
SRC_FILES:=$(shell find source/ -name "*.jpg")
SCALED_FILES:=$(patsubst source/%.jpg, scaled/%.jpg, $(SRC_FILES))
.PHONY: all
all: scale
.PRECIOUS: %/
%/:
mkdir -p $@
.PHONY: clean
clean:
$(RM) -r scaled
.PHONY: scale
scale: $(SCALED_FILES)
scaled/%.jpg: source/%.jpg | scaled/
< $< jpegtopnm | pnmscale -xysize 1280 962.4 | pnmtojpeg --quality 85
--progressive > $@
● https://www.facebook.com/creazione4u/

More Related Content

Similar to Makefiles for automating image processing

Front end optimization
Front end optimizationFront end optimization
Front end optimization
Abhishek Anand
 
Viktor Tsykunov "Microsoft AI platform for every Developer"
Viktor Tsykunov "Microsoft AI platform for every Developer"Viktor Tsykunov "Microsoft AI platform for every Developer"
Viktor Tsykunov "Microsoft AI platform for every Developer"
Lviv Startup Club
 
Python_for_Visual_Effects_and_Animation_Pipelines
Python_for_Visual_Effects_and_Animation_PipelinesPython_for_Visual_Effects_and_Animation_Pipelines
Python_for_Visual_Effects_and_Animation_Pipelines
Russell Darling
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabric
andymccurdy
 

Similar to Makefiles for automating image processing (20)

Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
 
How to use TripleO tools for your own project
How to use TripleO tools for your own projectHow to use TripleO tools for your own project
How to use TripleO tools for your own project
 
Front end optimization
Front end optimizationFront end optimization
Front end optimization
 
Viktor Tsykunov "Microsoft AI platform for every Developer"
Viktor Tsykunov "Microsoft AI platform for every Developer"Viktor Tsykunov "Microsoft AI platform for every Developer"
Viktor Tsykunov "Microsoft AI platform for every Developer"
 
Slim3 quick start
Slim3 quick startSlim3 quick start
Slim3 quick start
 
Python_for_Visual_Effects_and_Animation_Pipelines
Python_for_Visual_Effects_and_Animation_PipelinesPython_for_Visual_Effects_and_Animation_Pipelines
Python_for_Visual_Effects_and_Animation_Pipelines
 
Web Performance: 3 Stages to Success
Web Performance: 3 Stages to SuccessWeb Performance: 3 Stages to Success
Web Performance: 3 Stages to Success
 
A holistic approach to web performance
A holistic approach to web performanceA holistic approach to web performance
A holistic approach to web performance
 
How to Puppetize Google Cloud Platform - PuppetConf 2014
How to Puppetize Google Cloud Platform - PuppetConf 2014How to Puppetize Google Cloud Platform - PuppetConf 2014
How to Puppetize Google Cloud Platform - PuppetConf 2014
 
QConSP 2015 - Dicas de Performance para Aplicações Web
QConSP 2015 - Dicas de Performance para Aplicações WebQConSP 2015 - Dicas de Performance para Aplicações Web
QConSP 2015 - Dicas de Performance para Aplicações Web
 
Optimizing wp
Optimizing wpOptimizing wp
Optimizing wp
 
Jenkins Pipelines Advanced
Jenkins Pipelines AdvancedJenkins Pipelines Advanced
Jenkins Pipelines Advanced
 
Magento2 Basics for Frontend Development
Magento2 Basics for Frontend DevelopmentMagento2 Basics for Frontend Development
Magento2 Basics for Frontend Development
 
Deploying configurable frontend web application containers
Deploying configurable frontend web application containersDeploying configurable frontend web application containers
Deploying configurable frontend web application containers
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabric
 
Designing For Occasionally Connected Apps Slideshare
Designing For Occasionally Connected Apps SlideshareDesigning For Occasionally Connected Apps Slideshare
Designing For Occasionally Connected Apps Slideshare
 
Continuous Deployment: The Dirty Details
Continuous Deployment: The Dirty DetailsContinuous Deployment: The Dirty Details
Continuous Deployment: The Dirty Details
 
Image Converter script for PNG to JPG & JPG to PNG.pdf
Image Converter script for PNG to JPG & JPG to PNG.pdfImage Converter script for PNG to JPG & JPG to PNG.pdf
Image Converter script for PNG to JPG & JPG to PNG.pdf
 
Future of Development and Deployment using Docker
Future of Development and Deployment using DockerFuture of Development and Deployment using Docker
Future of Development and Deployment using Docker
 
How to make your Eclipse application HiDPI ready!
How to make your Eclipse application HiDPI ready!How to make your Eclipse application HiDPI ready!
How to make your Eclipse application HiDPI ready!
 

Makefiles for automating image processing

  • 1. Makefiles for Automating Image Processing Shweta Sadawarte CEO Nelkinda Software Craft Pvt Ltd
  • 2. Problem ● Scale a large set (200+) of images to a target resolution. ● Target resolution might change due to website redesign -> scaling has to be repeated ● Image set might change - new images might be added later.
  • 3. Solution ● Automatable image processing using NetPBM ● Automation using GNU make
  • 4. Why to use make? ● Having a set of input files that shall be transformed to a set of output files according to certain rules is the nature of make. ● The make program uses timestamp to decide which of the files need to be updated.
  • 5. SRC_FILES:=$(shell find source/ -name "*.jpg") SCALED_FILES:=$(patsubst source/%.jpg, scaled/%.jpg, $(SRC_FILES)) .PHONY: all all: scale .PRECIOUS: %/ %/: mkdir -p $@ .PHONY: clean clean: $(RM) -r scaled .PHONY: scale scale: $(SCALED_FILES) scaled/%.jpg: source/%.jpg | scaled/ < $< jpegtopnm | pnmscale -xysize 1280 962.4 | pnmtojpeg --quality 85 --progressive > $@