Resize and Crop

contoystudio

Member
Licensed User
Hi,
I'd like to know if exist a library/class that permit to crop/resize an image through given proportions. Something like android does when we change background in the homescreen.

Thank you in advance
 

contoystudio

Member
Licensed User
I'd like to do exactly what android (or apps like instagram) does when you pick an image from gallery and want set it as bg image (or want to share it in instagram): they force you to crop that image, for example instagram wants only square images.
Instagram screen shot: http://cdn.guidingtech.com/assets/postimages/2012/04/Instagram-for-Android-crop-image.png

I'm trying to do io manually with panel's touch event, but it's a little complex and I'd like to know if someone already done this job.

Thanks

[Edit: something like this https://github.com/lorensiuswlt/AndroidImageCrop]
 
Last edited:

klaus

Expert
Licensed User
I haven't done this.
But it shouldn't be that complicated.
- display the original image
- define the crop rectangle in a panel
- copy the croped image to a bitmap
- copy the bitmap to a file

Best regards.
 

contoystudio

Member
Licensed User
Ok thank you.
The most complex part for me is to implement the dynamic crop rectangle. Im using a moveable panel and other 4 small panel on its borders for resizing it, with the touch event. Im on the right way?
 

klaus

Expert
Licensed User
I would probably do with a transparent panel on top, use it's touch event to move the edges of the crop rectangle doing all this graphicaly.
If you want you can post your code and I'll have a look at it.

Best regards.
 
Last edited:

contoystudio

Member
Licensed User
Now i have a panel on top, but i have other 4 small panel for resize it, cause in the touch event of the panel i put coding for moving it, not resizing. The other 4 small panels have coding for resizing. Is there another way to do this without these 4 small panels? I will post my test code asap.

Sorry for bad english if you cant understand, im from italy. Thank you very much for your help.

[Edit: Project attached, is only a test for the dynamic crop/resize rect. There are still some bugs, i'm working on it.]
 

Attachments

Last edited:

klaus

Expert
Licensed User
I have begun to look at your project but not finished yet.
This afternoon I'm leaving my home for a few days to the mountains for hiking till the end of the week.
I'll come back when I get home.

Best regards.
 
Last edited:

klaus

Expert
Licensed User
Hi,

I'm back home.

I joined a picture from my hike on Tuesday above the Aletsch glacier.

Attached you find my vision of resizing an image.
I haven't tested all possible configurations.
There is no graphics showing what function is active but could be added.

Best regards.
 

Attachments

contoystudio

Member
Licensed User
Hi,

I'm back home.

I joined a picture from my hike on Tuesday above the Aletsch glacier.

Attached you find my vision of resizing an image.
I haven't tested all possible configurations.
There is no graphics showing what function is active but could be added.

Best regards.
Thank you very much.
It's perfect, only one question:
How can i add a marker on angles?

Thanks.
 

cmartins

Member
Licensed User
I am trying to change some things in the code but I cannot move the imageviews or change the size. How can I use the drawbitmap in different imageview sizes?
 

Attachments

Top