Skip to content

Commit

Permalink
Fixed image wrapping for subsections smaller than a single image
Browse files Browse the repository at this point in the history
  • Loading branch information
theFroh committed Oct 12, 2015
1 parent c524108 commit b8bd3ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Binary file modified imagepacker/__pycache__/imagepacker.cpython-34.pyc
Binary file not shown.
6 changes: 5 additions & 1 deletion imagepacker/imagepacker.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def crop_by_extents(image, extent, wrap=False, crop=False):
if extent.to_wrap:
h_w, v_w = extent.wrapping()

new_im = Image.new("RGBA", (math.ceil(h_w*w), math.ceil(v_w*h)))
new_im = Image.new("RGBA", (max(w,math.ceil(h_w*w)), max(h,math.ceil(v_w*h))))
new_w, new_h = new_im.size

# Iterate through a grid, to place the image to tile it
Expand All @@ -173,6 +173,10 @@ def crop_by_extents(image, extent, wrap=False, crop=False):
crop_coords[3] = crop_coords[3] - crop_coords[1]
crop_coords[1] = 0

image.show()
new_im.show()

pprint(crop_coords)
image = new_im.crop(crop_coords)
else:
coords[0] = max(coords[0], 0)
Expand Down

0 comments on commit b8bd3ce

Please sign in to comment.