å æ¥ãªãªã¼ã¹ããPictRubyã使ã£ã¦Instagram風ã®æ¨ªä¸¦ã¹ã°ãªããç»åãä½ã£ã¦ã¿ã¾ãã
The Week on Instagram | 208
https://t.co/S5Bf5ok5wv pic.twitter.com/xwFLrYvLsj
— Instagram (@instagram) 2015, 11æ 8
ã¤ã³ã¹ãã¼ã«ã¯ãã¡ãããã©ããã
ã¤ã³ã¹ãã¼ã«
- ãã®ã½ã¼ã¹ã³ã¼ããã¯ãªãããã¼ãã«ã³ãã¼ãã¾ã(view rawã便å©ã§ã)
- PictRubyãèµ·åãã¾ã
- '+'ãã¿ã³ãæ¼ãã¦æ°ãããã¡ã¤ã«ãä½ãã¾ã
- ã½ã¼ã¹ã³ã¼ããè²¼ãä»ãã¦'Run'ãã¿ã³ãæ¼ãã¾ã
- ã¢ã«ãã ãã好ããªåçã9ææå®ãã¾ã
å®è¡çµæ
ãã®ãããª9æã®åçãã»ã»
ãããªæãã«ã¬ã¤ã¢ã¦ãããã¾ãã(å ç»åã¯ãµã¤ãºãã©ãã©ã§ãèªåã§æ£æ¹å½¢ã«åãåºãã¦ç¶ºéºã«ã¬ã¤ã¢ã¦ããã¦ããã¾ã)
ã½ã¼ã¹ã³ã¼ã解説
# Please return the Image object in the def convert # ã¢ã«ãã ããåçã9æåå¾ imgs = Image.pick_from_library(9) ImageUtil.horizontal([ # æåã®ç»åãæ£æ¹å½¢ imgs[0].square, # 2ã5æç®ãå ¨ã¦æ£æ¹å½¢ã«ãã¦ã2x2ã®ã°ãªããç»åã« ImageUtil.grid(imgs[1..4].map { |e| e.square }), # 6ã9æç®ãå ¨ã¦æ£æ¹å½¢ã«ãã¦ã2x2ã®ã°ãªããç»åã« ImageUtil.grid(imgs[5..8].map { |e| e.square }) ]) # ä½ã£ãç»åã横ã«ä¸¦ã¹ã end
çµæã¨ãã¦
----------------- | 1 | 2x2 | 2x2 | -----------------
ãªæ¨ªé·ç»åãå®æãã¾ããå¿ç¨ã§
----------------- | 2x2 | 1 | 2x2 | -----------------
ãªã©è²ã ãªã¬ã¤ã¢ã¦ããä½ãã¾ãã