Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distorted image when apply at least on filter #291

Open
lillogoal opened this issue Nov 19, 2020 · 20 comments
Open

Distorted image when apply at least on filter #291

lillogoal opened this issue Nov 19, 2020 · 20 comments

Comments

@lillogoal
Copy link

lillogoal commented Nov 19, 2020

Hi,

i have the problem in subject. My Flow is:
Download with glide a bitmap and after i will send to PhotoEditor library. When i select at least one filter (gray,rotate, ecc...) the image is distorted.

I checked size of bitmap and it is ok. I checked size of surfaceView and she changes when applying the first filter

@OverRide
public void onSurfaceChanged(GL10 gl, int width, int height) {
if (mTexRenderer != null) {
Log.e("ONSURFCHANGED",width+"\nHeight:"+height);
mTexRenderer.updateViewSize(width, height);
}
}

Before

Screenshot_1605772807

After

Screenshot_1605772871

@lazy-coder-10
Copy link

You can fix this issue by saving the captured image in the gallery and use that file path because if you take an image directly from the camera then the size of that image is very small and this is the reason the image is getting destored.

@lillogoal
Copy link
Author

lillogoal commented Dec 17, 2020

@rohit6027 i'm downloading image with glide with code:

final GlideUrl glideUrl = GenericUtility.getGlideUrlFromData(BackendMethods.URL_IMG_TIMELINE_PATH+ picMatch.get_key(), MyApplication.getUser().getWtkn());
Glide.with(EditImageActivity.this)
.load(glideUrl)
.asBitmap()
.into(new SimpleTarget() {
@OverRide
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
mPhotoEditorView.getSource().setImageBitmap(resource);
}});

so i'm using bitmap. do you think that correct way is going to save in sd and after ?

@lazy-coder-10
Copy link

lazy-coder-10 commented Dec 17, 2020

It doesn't matter how you are loading the image in image view the only thing matter is what file path are you using.
how are you getting below path in onActvityResult.

GenericUtility.getGlideUrlFromData(BackendMethods.URL_IMG_TIMELINE_PATH+ picMatch.get_key(),

@lillogoal
Copy link
Author

@rohit6027 mmm path is my server next i download the image and setBitmap I don't understand where the problem is

@lillogoal
Copy link
Author

@rohit6027 any updates ? ty

@lazy-coder-10
Copy link

@lillogoal your case is different but the problem I was facing is the same. I solved my problem after saving the actual image size in gallery when the user clicks an image from the camera.

@lillogoal
Copy link
Author

@lillogoal your case is different but the problem I was facing is the same. I solved my problem after saving the actual image size in gallery when the user clicks an image from the camera.

so you suggest me to save in external directory and after loads in photoeditor view ? can you post an example of saving and loading image ? thanks

@lazy-coder-10
Copy link

@lillogoal no need to save image in an external directory. It will be great if you share a complete image link that you are trying loading in the photo editor view.

@lillogoal
Copy link
Author

@lillogoal no need to save image in an external directory. It will be great if you share a complete image link that you are trying loading in the photo editor view.

sorry but link required auth request with bearer.

i understud image has to save in gallery right ?

@lazy-coder-10
Copy link

I am not sure it will work or not but you can try it.

@lillogoal
Copy link
Author

@rohit6027 yes i can try but you can send me an example of saving in gallery and load from gallery. ty

@lazy-coder-10
Copy link

In the beginning, I said I am taking an image from the camera but you are taking it from the server.

@lillogoal
Copy link
Author

yes yes but after taking from server i convert in bitmap so maybe your implementation is ok. I am desperate I have tried everything

@lazy-coder-10
Copy link

is it happening with every image URL which you getting from the backend ?? if yes then I will create a sample for the same issue else you can share your image URL if possible.

@lazy-coder-10
Copy link

lazy-coder-10 commented Jan 4, 2021

@lillogoal its working file with the URL also I am using this url -> [https://www.webconfs.com/comics/dynamic-vs-static-urls-comic.jpg]

@lillogoal
Copy link
Author

My flow is: user capture image -> upload on server -> other user download image and need to modify it.

If user in the first step decide to load an image from gallery (low resolution maybe) it works. I tested with your url: "https://www.webconfs.com/comics/dynamic-vs-static-urls-comic.jpg" --> it works.

So in my opinion problem is when user capture and upload image with high resolution.

Screenshot_1609770302

@lazy-coder-10
Copy link

yes you are right. how you are capturing the image ?? are you saving actual image size in local storage ??

@lillogoal
Copy link
Author

  PickSetup pickSetup = new PickSetup().setWidth(600).setHeight(400).setGalleryButtonText(getString(R.string.galleria)).setTitle(getString(R.string.choose)).setCancelText(getString(R.string.annulla));
        PickImageDialog.build(pickSetup).show(this).setOnPickResult(new IPickResult() {
            @Override
            public void onPickResult(PickResult pickResult) {
                if (pickResult.getError() == null) {
                    Log.e("PATH",pickResult.getPath());
                    File file = new File(Environment.getExternalStorageDirectory()+File.separator+"img_"+System.currentTimeMillis()+".jpg");

                    UCrop.of(pickResult.getUri(), Uri.fromFile(file))
                            .start(PhotoToBetActivity.this,REQUEST_IMAGE_CROP);
                } else {

                    //Handle possible errors
                    //TODO: do what you have to do with r.getError();
                    Toast.makeText(PhotoToBetActivity.this, pickResult.getError().getMessage(), Toast.LENGTH_LONG).show();
                }
            }
        });

I think yes, this is my code, i used a picksetup library, and after selection or capture image user can crop using UCrop library

@lazy-coder-10
Copy link

remove .setWidth(600).setHeight(400) and try again may be this is the problem.

@lillogoal
Copy link
Author

You are right!! I'm testing with more and more cases. After tests i will reply with result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants