diff options
author | plward11 <plward11@stanford.edu> | 2014-01-22 08:12:26 -0800 |
---|---|---|
committer | plward11 <plward11@stanford.edu> | 2014-01-22 08:12:26 -0800 |
commit | 1d4daff47cde0c1a1bf4b641598879ff1a6e0931 (patch) | |
tree | 1b1548862ae448567cb6b10444e17130455e1d97 /wikipedia | |
parent | 1dcc1d2ba60bca5a11fca5a9e6001c62f9170a84 (diff) | |
parent | f3f8608f3574c0790b94d9a283c25b6cfb01a220 (diff) |
Merge pull request #515 from endlessm/issues/487
Crop category pixbufs from bottom left
Diffstat (limited to 'wikipedia')
-rw-r--r-- | wikipedia/utils.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/wikipedia/utils.js b/wikipedia/utils.js index f08deed..0838bd5 100644 --- a/wikipedia/utils.js +++ b/wikipedia/utils.js @@ -164,7 +164,8 @@ const array_contains = function (arr, obj, same_type) { /* * Loads a pixbuf sized to cover the dest_width and dest_height with the - * image in res_path, while mataining the aspect ratio of the image + * image in res_path, while mataining the aspect ratio of the image. + * The anchor point for cropping is the bottom left of the image. */ function load_pixbuf_cover(res_path, dest_width, dest_height) { let [load_width, load_height] = [dest_width, dest_height]; @@ -184,7 +185,8 @@ function load_pixbuf_cover(res_path, dest_width, dest_height) { load_width, load_height, true); let cropped_pixbuf = source_pixbuf; if(dest_width < source_pixbuf.width || dest_height < source_pixbuf.height) - cropped_pixbuf = source_pixbuf.new_subpixbuf(0, 0, dest_width, dest_height); + cropped_pixbuf = source_pixbuf.new_subpixbuf(0, source_pixbuf.height - dest_height, + dest_width, dest_height); return cropped_pixbuf; } |