wasabeef / picasso-transformations Goto Github PK
View Code? Open in Web Editor NEWAn Android transformation library providing a variety of image transformations for Picasso
License: Apache License 2.0
An Android transformation library providing a variety of image transformations for Picasso
License: Apache License 2.0
I believe it's not necessary to create squaredBitmap
. Instead, the BitmapShader
can be given a Matrix
that has setTranslate(-width, -height)
. This should accomplish the same thing that creating squaredBitmap
does, shifting the viewport on source
so that its centre is drawn into bitmap
.
Dear wasabeef,
I have some feature request.
I need to clean specific color and change it to transparent.
Could it be possible to implement new feature or any suggestion that I can modify your class?
I want to remain only radar stuff and change background and seashore lines to transparent..
So
I just want to set cleaned image to the overlay of google maps
Many Thanks for your great work!!
Couldn't build my project with your library included.
Error:duplicate files during packaging of APK /app/build/outputs/apk/app-debug-unaligned.apk
Path in archive: lib/armeabi-v7a/libblasV8.so
Origin 1: /app/build/intermediates/exploded-aar/jp.wasabeef/picasso-transformations/1.3.1/jni/armeabi-v7a/libblasV8.so
Origin 2: /build-tools/23.0.2/renderscript/lib/packaged/armeabi-v7a/libblasV8.so
You can ignore those files in your build.gradle:
android {
packagingOptions {
exclude 'lib/armeabi-v7a/libblasV8.so'
}
}
Error:Execution failed for task ':app:packageDebug'.
Duplicate files copied in APK lib/armeabi-v7a/libblasV8.so
File 1: /app/build/intermediates/exploded-aar/jp.wasabeef/picasso-transformations/1.3.1/jni/armeabi-v7a/libblasV8.so
File 2: /build-tools/23.0.2/renderscript/lib/packaged/armeabi-v7a/libblasV8.so
I tried excluding the lib from packaging options as suggested by the compiler, but it didn't work. That could be a problem on my end. I'll be going with another library in any case. I also tried
CropCircleTransformation
has no parameters, several instances are useless.
This class may provide a static getInstance()
method and return the same instance every time, and thus public constructor should be deprecated.
Hello,
Thanks for the library , this was what i needed!
It always go in onPrepareLoad and then onBitmapFailed! and errorDrawable is null.
Picasso.with(CameraActivity.this).load(filename)
.transform(new SwirlFilterTransformation(CameraActivity.this)).into(new Target() {
@OverRide
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
imageView.setImageBitmap(bitmap);
bmp = bitmap;
}
@Override
public void onBitmapFailed(Drawable errorDrawable) {
}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
});
CropCenter isn't doing what I expect in the example app. The demo.jpg is 640x359 and the CropCenter example crops it to 300x100 center - I would expect the resulting image to just about cover the dogs' heads but it seems to be full width as you can see the red stripe on the far left of the first dog and the wicker basket on the shelf on the right?
Hey,
Very nice lib but is there a way to also transform the error and the placeholder image?
it perform bad blur effect such as loading this image:
http://www.xero.com/blog/wp-content/uploads/2014/08/xerocon5-e1408596368465.png
Unable to apply on SandboxView instead of image?
It would be nice if the POM included the gpuimage-library dependency, so that it will be downloaded automatically with picasso-transformations and we don't have to add that additional dependency to our projects.
.transform(new CropTransformation(1.2f, CropTransformation.GravityHorizontal.CENTER, CropTransformation.GravityVertical.TOP))
Fatal Exception: java.lang.RuntimeException
Transformation CropTransformation(width=600, height=451, mWidthRatio=0.0, mHeightRatio=0.0, mAspectRatio=1.33, gravityHorizontal=CENTER, mGravityVertical=TOP) crashed with exception.
Caused by java.lang.NullPointerException
android.graphics.Canvas. (Canvas.java:136)
jp.wasabeef.picasso.transformations.CropTransformation.transform (CropTransformation.java:301)
com.squareup.picasso.BitmapHunter.applyCustomTransformations (BitmapHunter.java:429)
com.squareup.picasso.BitmapHunter.hunt (BitmapHunter.java:238)
com.squareup.picasso.BitmapHunter.run (BitmapHunter.java:159)
java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:422)
java.lang.Thread.run (Thread.java:848)
com.squareup.picasso.Utils$PicassoThread.run (Utils.java:411)
Device:
apiLevel - 15 (4.0.4)
ZTE - model Grand X In
Cannot reproduce on my devices, reported from user device on production app.
Stack trace:
java.lang.RuntimeException: Transformation BlurTransformation(radius=15, sampling=5) crashed with exception.
at com.squareup.picasso.BitmapHunter$3.run(BitmapHunter.java:434)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Method.java:-2)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(NativeStart.java:-2)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=65536; index=65538
at jp.wasabeef.picasso.transformations.internal.FastBlur.blur(FastBlur.java:125)
at jp.wasabeef.picasso.transformations.BlurTransformation.transform(BlurTransformation.java:73)
at com.squareup.picasso.BitmapHunter.applyCustomTransformations(BitmapHunter.java:429)
at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:238)
at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:159)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:411)
Hello,
I need doing crop the image left! Have any suggestions or solution?
Here is a gist with working BorderedCircleTransform implemenetation:
https://gist.github.com/berkkaraoglu/ab4caa8b1fe48231dec2
Since #36 It throws an error compiling:
Warning:Exception while processing task java.io.IOException: proguard.ParseException: Unknown option 'com.squareup.okhttp' in line 3 of file '/Users/user/.gradle/caches/transforms-1/files-1.1/picasso-transformations-2.2.0.aar/16c5d97f0c603c4db20540986cd71722/proguard.txt'
In picasso-transformations/transformations/proguard-rules.txt it says:
-dontwarn dontwarn com.squareup.okhttp
I think it should be:
-dontwarn com.squareup.okhttp
Using Picasso fit
function along with RoundedCornersTransformation(int radius, int margin, CornerType cornerType)
constructor result into overlapping images
Layout xml
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:gravity="center_horizontal" >
<ImageView
android:id="@+id/with_corner_type"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_gravity="center_horizontal"
android:background="#F00"
android:gravity="center_horizontal"
android:text="@string/hello_world" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/with_corner_type"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:text="With CornerType"
android:textColor="#FFF" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:gravity="center_horizontal" >
<ImageView
android:id="@+id/without_corner_type"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_gravity="center_horizontal"
android:background="#F00"
android:gravity="center_horizontal"
android:text="@string/hello_world" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/without_corner_type"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:text="Without CornerType"
android:textColor="#FFF" />
</RelativeLayout>
Loading images with RoundedCornersTransformation
//Using fit without CornerType
Picasso.with(getApplicationContext()).load(R.drawable.kitten).fit().centerCrop()
.transform(new RoundedCornersTransformation(50, 50))
.into((ImageView) findViewById(R.id.without_corner_type));
//Using fit with CornerType
Picasso.with(getApplicationContext()).load(R.drawable.kitten).fit().centerCrop()
.transform(new RoundedCornersTransformation(50, 50, CornerType.DIAGONAL_FROM_TOP_RIGHT))
.into((ImageView) findViewById(R.id.with_corner_type));
Result :- The red color highlights actual size of imageView
I am sorry if this is trivial, but I am a beginner. and currently I am using Kotlin. I want to blur my image after downloading using picasso.
and here is the code I use:
Picasso.get()
.load(currentEvent.posterDownloadPath)
.transform(BlurTransformation(25,3))
.into(recommendedEventViewHolder.blurryImageView)
but unfortunately I have error like in this image: https://i.stack.imgur.com/Nvq53.png
so how to properly use BlurTransformation effect ?
is it possible to add effect to bitmap ?
already add renderscript in build.gradle:
defaultConfig {
applicationId "xxx"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
renderscriptSupportModeEnabled true
}
when i build the project:
Path in archive: lib/armeabi-v7a/libblasV8.so
Error:duplicate files during packaging of APK /Users/rowandjj/AndroidStudioProjects/PaimaiNews/app/build/outputs/apk/app-debug-unaligned.apk
Origin 1: /Users/rowandjj/Library/Android/sdk/build-tools/23.0.1/renderscript/lib/packaged/armeabi-v7a/libblasV8.so
Origin 2: /Users/rowandjj/AndroidStudioProjects/PaimaiNews/app/build/intermediates/exploded-aar/jp.wasabeef/picasso-transformations/1.3.0/jni/armeabi-v7a/libblasV8.so
so i exclude those .so file by packingOptions:
packagingOptions{
exclude 'lib/armeabi-v7a/libblasV8.so'
exclude 'lib/armeabi-v7a/librsjni.so'
exclude 'lib/armeabi-v7a/libRSSupport.so'
exclude 'lib/mips/libblasV8.so'
exclude 'lib/mips/librsjni.so'
exclude 'lib/mips/libRSSupport.so'
exclude 'lib/x86/libblasV8.so'
exclude 'lib/x86/librsjni.so'
exclude 'lib/x86/libRSSupport.so'
}
but it not worked either.....
what should i do?
RSBlur creates 4 Objects(2 Allocation, RenderScript and ScriptIntrinsicBlur) but it only destroys the RenderScript. This causes the resources to stick around and never get released. Calling destroy on all of those object in the finally clause fixes the issue.
I will try to find the time to make a PR.
Tested on a Nexus 6
Whenever I apply BlurTransformation with 10px or any px value for that matter. The image just becomes invisible. Anyone got a solution for this?
the blur effect is not blurry enough, how can i adjust the amount of blur?
hi,
Thanks for your awesome library.
But I have problems with integrate the lib into my app.
I tried to put this line
compile 'jp.wasabeef:picasso-transformations:2.1.0'
but nothing is downloaded. Can you give me some helps?
Thanks
Couldn't get this library from jcenter
Anything I missed here?
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
repositories {
mavenCentral()
// for using SNAPSHOT
//maven {
// url uri('https://oss.sonatype.org/content/repositories/snapshots/')
//}
}
apply plugin: 'com.android.application'
dependencies {
compile project(':library')
// Or, fetch from Maven:
// compile 'com.google.maps.android:android-maps-utils:0.3+'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'org.jsoup:jsoup:1.8.2'
compile 'jp.wasabeef:picasso-transformations:1.2.0'
// If you want to use the GPU Filters
//compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.3.0'
compile project(':appiraterAndroid')
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.teamhj.agriweather"
minSdkVersion 16
targetSdkVersion 21
versionCode 1010
versionName "1.0.10"
renderscriptTargetApi 22
renderscriptSupportModeEnabled true
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
}
}
}
task startDemo(type: Exec) {
dependsOn 'installDebug'
def adb = new File("${System.env.ANDROID_HOME}", "platform-tools${File.separator}adb")
commandLine adb, "shell", "am", "start", "-n", "com.google.maps.android.utils.demo/.MainActivity"
}
KuwaharaFilterTransformation turns the transparent part black.
I still want to leave it transparent or change it to white
Is there any way?
I can't recognize what is going wrong please help.
My code :
`Picasso.with(PlayScreenActivity.this)
.load(uri)
.transform(new BlurTransformation(this,25,10))
.placeholder(R.drawable.ic_default)
.error(R.drawable.ic_default)
.into(new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
}
@Override
public void onBitmapFailed(Drawable errorDrawable) {
}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
});`
See the crashlytic log report
| com.a.a.c$3.run (BitmapHunter.java:434)
| android.os.Handler.handleCallback (Handler.java:739)
| com.android.internal.os.ZygoteInit.main (ZygoteInit.java:779)
Caused by java.lang.IllegalArgumentException width and height must be > 0
| android.graphics.Bitmap.createBitmap (Bitmap.java:866)
| android.graphics.Bitmap.createBitmap (Bitmap.java:812)
| b.a.a.a.a.a (BlurTransformation.java:58)
| com.a.a.c.a (BitmapHunter.java:429)
| com.a.a.c.a (BitmapHunter.java:238)
| com.a.a.c.run (BitmapHunter.java:159)
| java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:422)
| java.lang.Thread.run (Thread.java:818)
| com.a.a.ah$d.run (Utils.java:411)
Bintray will end service on May 1st. Will you be moving the artifacts to another hosting solution or should we roll our own distributions?
https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.