5 Star 4 Fork 1

佰钧成开源官方组织 / CompressHelper

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

CompressHelper

Functions overview

​ 图片压缩:主要通过尺寸压缩和质量压缩,以达到清晰度最优

Effect picture

输入图片说明

Getting Started

Solution 1: Remote warehouse import project

implementation ‘com.gitee.baijuncheng-open-source:compresshelper:1.0.0’

Solution 2:Add compresshelper to your project

1.Copy the compresshelper/entry folder to the project directory

2.Modify settings.gradle under the project and add the dependency on this module as follows:

include ':entry', ':compresshelper'
  1. Introduce the dependency of the module under the project. Taking the entry module as an example, you need to modify the build.gradle file under the entry module to add the dependency:
implementation project(':compresshelper')

Solution 3: local use of har package integration

  1. Compile this project, copy the har package generated in the build directory of the compresshelper/entry folder to the project lib folder: directory:\CompressHelper_master\compresshelper\build\outputs\har\debug\compresshelper-debug.har
  2. Add the following code in the entry's gradle
implementation fileTree(dir:'libs', include: ['*.jar','*.har'])

​ More configuration can be found in the Project.Usage

  • Used within Ability:
newFile = CompressHelper.getDefault(getApplicationContext()).compressToFile(oldFile);
  • You can also customize compression
newFile = new CompressHelper.Builder(this)
       .setMaxWidth(720)  // 默认最大宽度为720
        .setMaxHeight(960) // 默认最大高度为960
        .setQuality(80)    // 默认压缩质量为80
        .setCompressFormat(ImageFormat.ComponentType.JPEG) // 设置默认压缩为jpg格式
        .setFileName(yourFileName) // 设置你的文件名
        .setDestinationDirectoryPath(
                Environment.DIRECTORY_PICTURES)
        .build()
        .compressToFile(oldFile);

Fealture

  • Supports compression of images of different formats, sizes and memory sizes

License

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.

空文件

简介

一个图片压缩库 展开 收起
Java
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/baijuncheng-open-source/compresshelper-master.git
git@gitee.com:baijuncheng-open-source/compresshelper-master.git
baijuncheng-open-source
compresshelper-master
CompressHelper
master

搜索帮助