在Javascript中复制和裁剪图片 [英] Copy and crop images in Javascript

查看:152
本文介绍了在Javascript中复制和裁剪图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Javascript / Canvas中创建一个小的2D游戏,由几个动画精灵组成。我想减少HTTP请求的数量,因此我将每个动画帧(32像素乘32像素)合并为一个图像(例如192像素乘128像素)。有什么办法,我可以复制和裁剪这些图像客户端回到几个较小的图像?

I'm trying to create a small 2D game in Javascript/Canvas which consists of several animated sprites. I'd like to cut down on the number of HTTP requests, so I combined each frame of animation (32px by 32px) into one image per sprite (say, 192px by 128px). Is there any way I can copy and crop these images clientside back into several smaller images? It would vastly simplify my rendering code and help reduce loading time due to network latency.

推荐答案

看看 Pixastic ,特别是 http://www.pixastic.com/lib/docs/actions/crop

这篇关于在Javascript中复制和裁剪图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆