Browse Source

Added code to correctly crop image views (otherwise they don't always display entirely)

pull/2/head
Youen 2 years ago
parent
commit
580abc0960
  1. 4
      ahb_raster_view.py

4
ahb_raster_view.py

@ -292,6 +292,9 @@ class RasterView:
image.X = view.X image.X = view.X
image.Y = view.Y image.Y = view.Y
image.ImageFile = self.image_file_name # TODO: see if it's possible to set a relative path 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() image.recompute()
def _render_lines(self, doc, resolution, parts, line_color, masking_parts, fast_render = True): 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" 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 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 = self._read_image(temp_file_name)
lines_bands_img.save('/home/youen/dev/vhelio/tmp/tmp.png')
lines_bands = lines_bands_img.split() lines_bands = lines_bands_img.split()
lines_img = lines_bands[1] lines_img = lines_bands[1]

Loading…
Cancel
Save