Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joshdholtz/cropimageview
Super easy component for Android to crop an image
https://github.com/joshdholtz/cropimageview
Last synced: 17 days ago
JSON representation
Super easy component for Android to crop an image
- Host: GitHub
- URL: https://github.com/joshdholtz/cropimageview
- Owner: joshdholtz
- License: mit
- Created: 2014-02-24T14:25:47.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-02-24T19:08:37.000Z (over 10 years ago)
- Last Synced: 2024-10-11T10:33:23.020Z (about 1 month ago)
- Language: Java
- Size: 1.23 MB
- Stars: 33
- Watchers: 5
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CropImageView - Android
Super easy component for Android to crop an image
![](https://raw.github.com/joshdholtz/CropImageView/master/screenshots/screenshot_1.png)
### Installation
- Download JAR from releases [crop-image-view-0.0.1.jar](https://github.com/joshdholtz/CropImageView/releases/tag/crop-image-view-0.0.1)
- Download and use as an Android library project### Example
````xml
````
````java
public class MainActivity extends Activity {
CropImageView cropImageView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
cropImageView = (CropImageView) this.findViewById(R.id.crop_image_view);
cropImageView.setImageResource(getResources(), R.drawable.josh_hood);
// OPTIONAL - set corner color size and crop area color
// cropImageView.setCornerDrawable(Color.rgb(255, 200, 0), 100, 100);
// cropImageView.setCropAreaDrawable(Color.LTGRAY, 150, Color.CYAN, 200, 8);
// OPTIONAL - keep crop square
// cropImageView.setKeepSquare(true);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);return(super.onCreateOptionsMenu(menu));
}@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.action_crop) {
try {
DisplayActivity.imageToShow = cropImageView.crop(this);
Intent intent = new Intent(this, DisplayActivity.class);
this.startActivity(intent);
} catch (IllegalArgumentException e) {
// Crop section is out of bounds of image
}
}
return(super.onOptionsItemSelected(item));
}
}````
## Author
Josh Holtz, [email protected], [@joshdholtz](https://twitter.com/joshdholtz)
## License
CropImageView is available under the MIT license. See the LICENSE file for more info.