From a53704e8796fce246d43714d8b3b02c4a328f037 Mon Sep 17 00:00:00 2001 From: Martin Hawlisch Date: Tue, 11 Apr 2006 17:04:42 +0000 Subject: [PATCH] * src/images/mk_blue_marble.py: Provide fallback if jpegtrans does not work/exist. svn: r6311 --- gramps2/ChangeLog | 2 +- gramps2/src/images/mk_blue_marble.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 61a3cd7cf..62207ebd8 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,6 +1,6 @@ 2006-04-11 Martin Hawlisch * src/images/mk_blue_marble.py: Properly exit on error to let `make` - stop in that case. + stop in that case; Provide fallback if jpegtrans does not work/exist. 2006-04-10 Martin Hawlisch * src/DataViews/_MapView.py: Reworked to display multiple smaller diff --git a/gramps2/src/images/mk_blue_marble.py b/gramps2/src/images/mk_blue_marble.py index f8c51bb1c..e93f24289 100644 --- a/gramps2/src/images/mk_blue_marble.py +++ b/gramps2/src/images/mk_blue_marble.py @@ -29,7 +29,12 @@ def process_file( imagefile, image_width, image_height, map_x, map_y, map_width, (tile_size,tile_size,x*tile_size,y*tile_size,outfile,imagefile) print cmd if os.system( cmd): - sys.exit("ERROR, image crop using jpegtran (part of libjpeg-progs) failed.") + print("WARNING: lossless crop using jpegtran (part of libjpeg-progs) failed. Trying lossy fallback") + cmd = "convert %s -crop %dx%d+%d+%d %s" %\ + (imagefile,tile_size,tile_size,x*tile_size,y*tile_size,outfile) + print cmd + if os.system( cmd): + sys.exit("ERROR, image crop using jpegtran (part of libjpeg-progs) and imagemagick failed.") else: print "tile %s already exists" % outfile tile_width = map_width/(image_width/tile_size)