---
title: "将png 切成ios android能用的格式"
author: "抛出异常的爱"
date: "2016-04-28T01:24:10Z"
tags: []
categories: ["Web前端"]
slug: "png-ios-android"
draft: false
lastmod: "2016-04-28T01:24:10Z"
id: 2294418
url: "https://loveexception.iteye.com/blog/2294418"
---

由于要求不高找了个在线切图的工具
http://images.my-addr.com/resize_png_online_tool-free_png_resizer_for_web.php
![](http://dl2.iteye.com/upload/attachment/0117/0245/2c2eec75-fd0f-3b73-8c06-1c58403e0960.jpg)

由于是按比例切的
不想手动选择
就写了个js

```java

var array =document.getElementsByTagName('option');
for(var b in array) { 
   if(array[b].value == 0)
   array[b].selected = true;
   if(array[b].value=='perc')
   array[b].selected =true;
}
var array =document.getElementsByTagName('input'); var map = [87,87,58,58,39,39,'100','100']
for(var b in array) { 
    if( array[b].size==4 && b.length>3 )
        b,array[b].value=map.pop(); 
}


```


外国的
http://romannurik.github.io/AndroidAssetStudio/nine-patches.html