6 Star 3 Fork 1

HarmonyOS-TPC/CompressHelper

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
4年前
Loading...
README

## CompressHelper 图片压缩,压缩Pixelmap,CompressImage 主要通过尺寸压缩和质量压缩,以达到清晰度最优。

使用方法

1、在Ability里面使用

    File newFile = CompressHelper.getDefault(this).compressToFile(oldFile);

2、也可以自定义属性

    File newFile = new CompressHelper.Builder(this)
        .setMaxWidth(720)  // 默认最大宽度为720
        .setMaxHeight(960) // 默认最大高度为960
        .setQuality(80)    // 默认压缩质量为80
        .setFileName(yourFileName) // 设置你需要修改的文件名
        .setCompressFormat(CompressFormat.JPEG) // 设置默认压缩为jpg格式
        .setDestinationDirectoryPath(Environment.getExternalStoragePublicDirectory(
                Environment.DIRECTORY_PICTURES).getAbsolutePath())
        .build()
        .compressToFile(oldFile);

entry运行要求

通过DevEco studio,并下载openharmonySDK 将项目中的build.gradle文件中dependencies→classpath版本改为对应的版本(即您当前IDE新建项目中所用的版本)

集成

allprojects{
    repositories{
        mavenCentral()
    }
}
implementation 'io.openharmony.tpc.thirdlib:CompressHelper:1.0.3'

Licenses

 Copyright 2017 nanchen(刘世麟)

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.

空文件

简介

图片压缩,压缩Pixelmap,CompressImage 主要通过尺寸压缩和质量压缩,以达到清晰度最优。 展开 收起
取消

发行版

暂无发行版

CompressHelper 开源评估指数

productivity 生产力
niche_creation 创新力
robustness 稳健性
collaboration 协作
contributor 贡献者
software 软件

贡献者 (5)

全部

语言

近期动态

2年前被 mamingshuai 移出了仓库
2年前将 于光叶 移出了仓库
2年前被 mamingshuai 移出了仓库
2年前将 于光叶 移出了仓库
3年多前被 mamingshuai 移出了仓库
加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/HarmonyOS-tpc/CompressHelper.git
git@gitee.com:HarmonyOS-tpc/CompressHelper.git
HarmonyOS-tpc
CompressHelper
CompressHelper
master

搜索帮助