burhanrashid52 / PhotoEditor

A Photo Editor library with simple, easy support for image editing using paints,text,filters,emoji and Sticker like stories.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crop

sepehr1014 opened this issue · comments

Thank you for this awesome project. You mentioned cropping functionality is next. Is it in active development? What's the expected time frame?

Crop selection will be added in future release. But for time being you can crop the image using CustomEffect.Builder() which is a wrapper on EffectFacotory check this link.

Thanks but having crop selection would be great. I personally think it's a must for any photo editor.

U think when can you add this future?

I don't have ETA for it. Currently, my schedule is a little tight this time.
If anyone is able to do it before me than PR's are welcome

would donation make this feature available :) ?

Donations are always welcome :) @animestanley

any updates about crop feature? :)

If anyone is able to do it before me than PR's are welcome

@burhanrashid52 do you have an example of cropping you are using for reference?

Tried this library Android Image Cropper

Rect cropRect = imageCropView.getCropRect()
CustomEffect customEffect = new CustomEffect.Builder(EffectFactory.EFFECT_CROP)
                        .setParameter("xorigin", cropRect.left)
                        .setParameter("yorigin", cropRect.right)
                        .setParameter("width", cropRect.width())
                        .setParameter("height", cropRect.height())
                        .build();
                photoEditor.setFilterEffect(customEffect);

But its not cropping correctly. tried both imageCropView.getCropRect() and imageCropView.getCropWindowRect()

I think i need the width and height of your FilterImageView

EDIT: finally managed it to get working. But another problem is after cropping the image. the PhotoEditorView shows stretched image.

@akhilakhi84 can you please elaborate what you did and if you managed to make it work?

For those following this: If your use case is to only crop the image once, before it is loaded, I was able to get this working with uCrop. The solution is blunt: Just crop the incoming image before loading it into the PhotoEditor.

The tricky part about solving this is cropping after the image has stickers, text, etc on it. All the things I've tried involve adding additional layers to the canvas, which isn't great. Also cropping with rotation is a whole other dimension. I don't have a solution I like yet.

For me if could manage get photoeditor source and implement fragment dialog to crop image and replace back the image is better.

If we can get photoeditorview source then we can crop image..After highlighting image or writing text we cannot get edited image to crop.. How to get edited image??