From 580abc0960e425381323eb6fdf1bc1ea15501328 Mon Sep 17 00:00:00 2001 From: Youen Date: Sat, 31 Dec 2022 16:22:01 +0100 Subject: [PATCH] Added code to correctly crop image views (otherwise they don't always display entirely) --- ahb_raster_view.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ahb_raster_view.py b/ahb_raster_view.py index 0738fbc..e5ce580 100644 --- a/ahb_raster_view.py +++ b/ahb_raster_view.py @@ -292,6 +292,9 @@ class RasterView: image.X = view.X image.Y = view.Y image.ImageFile = self.image_file_name # TODO: see if it's possible to set a relative path + image.ViewObject.Crop = True + image.Width = composite_img.size[0] * image_scale / 10.0 * 1.01 + image.Height = composite_img.size[1] * image_scale / 10.0 * 1.01 image.recompute() def _render_lines(self, doc, resolution, parts, line_color, masking_parts, fast_render = True): @@ -324,7 +327,6 @@ class RasterView: temp_file_name = tempfile.gettempdir() + "/ahb_temp_image.png" doc_view.saveImage(temp_file_name, resolution[0]+2, resolution[1]+2, "#ff0000") # we add 1 pixel border that we will need to crop later lines_bands_img = self._read_image(temp_file_name) - lines_bands_img.save('/home/youen/dev/vhelio/tmp/tmp.png') lines_bands = lines_bands_img.split() lines_img = lines_bands[1]