hansemannn / titanium-image-crop

An easy to use iOS image cropping tool based on TOCropViewController.
MIT License
40 stars 5 forks source link
appcelerator image-cropping javascript native titanium

Titanium Image Cropping Tool

An easy to crop images to different scales. Based on the awesome TOCropViewController library. Currently iOS only (!)

Example Screenshot Example Screenshot rounded cropping

Requirements

Methods

showCropDialog

Parameters

Constants

Events

Notes

Example

import ImageCrop from 'ti.imagecrop';

ImageCrop.addEventListener('done', event => {
  if (event.cancel) {
    return;
  }

  win.add(Ti.UI.createImageView({ height: 400, image: event.image }));
});

ImageCrop.addEventListener('close', event => {
  // Open other windows after the close has been triggered
  // to prevent transition glitches
});

const win = Ti.UI.createWindow({
  backgroundColor: '#fff'
});

const btn = Ti.UI.createButton({
  title: 'Show crop dialog'
});

btn.addEventListener('click', () => {
  ImageCrop.showCropDialog({
    image: 'test.jpg'
  });
});

win.add(btn);
win.open();

License

MIT

Author

Hans Knöchel