裁切图像钛在preVIEW屏幕 [英] Crop Image in Titanium in the Preview Screen

查看:161
本文介绍了裁切图像钛在preVIEW屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建它使用摄像头/库的应用程序。我正在用相机拍照,并有一次我拍了照,设备将自动显示在iOS的一个preVIEW屏幕,让我移动,并根据需要扩展我的形象。在Android中,我手动创建一个preVIEW窗口。

I am creating an application which uses camera/gallery. I am taking a photo using camera and once I took the picture, the device will automatically display a preview screen in iOS, allows me to move and scale my image as required. In android, I manually created a preview window.

不过,我想,分辨率610x320像素裁剪图像。

But I want to crop the image with a resolution 610x320 pixels.

下面是code采取图片

Here is the code for taking image

Ti.Media.showCamera({
success:function(event) {
     if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {
    var image = event.media;
    var ImageFactory = require('ti.imagefactory');
    var newBlob = ImageFactory.imageAsCropped(image, {width:610, height:320 });
            imgvwCapturedImage.image = newBlob; //imgvwCapturedImage is an image view
     }
    },
cancel:function() {},
    error:function(error) {
        alert("Sorry, Unable to to process now.Please retry later.");
    },
saveToPhotoGallery:true,
    allowEditing:true,
    mediaTypes:[Ti.Media.MEDIA_TYPE_PHOTO]
});

我能够裁剪使用图像的 imageFactory模块只有后,从preVIEW屏幕选择照片。是否有机会做同样的在preVIEW屏幕本身,以便用户可以识别哪个区域是越来越裁剪?

I was able to crop the image using the imageFactory module only after selecting the photo from the preview screen. Is there any chance to do the same at the preview screen itself so that the user can identify which area is getting cropped?

任何帮助将AP preciated。

Any help will be appreciated.

推荐答案

我已经创建了自己的preVIEW屏幕适用于iOS和滚动型和图像工厂模块的帮助裁剪图像。现在,它的工作完美。您可能会发现一个样品code 这里。然而,这不会是Android设备的工作。

I have created my own preview screen for iOS and cropped the image by the help of a scrollView and image factory module. Now it's working perfect. You may find a sample code here. However this will not be working for Android devices.

这篇关于裁切图像钛在preVIEW屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆