简体   繁体   English

是否可以在加速器Titanium中像素化图像?

[英]Is it possible to pixelate an image in appcelerator Titanium?

I'm writing an Android and IOS app using Appcelerator Titanium, and I can't find a way to pixelate an image. 我正在使用Appcelerator Titanium编写Android和IOS应用程序,但找不到像素化图像的方法。 The app that I'm writing, needs to do that: pixelate a given image with a parameter given by user, (the greater the number, the greater the pixels). 我正在编写的应用程序需要做到这一点:使用用户指定的参数对给定的图像进行像素化(数字越大,像素越大)。 I have found a way to do it with Xcode for IOS, and in Android SDK for Android, but if possible, I would like to do it in Titanium to avoid writing the whole app twice, one for Android and other for IOS. 我已经找到了一种使用Xcode的IOS和Android的Android SDK的方法,但是,如果可能的话,我想在Titanium中这样做以避免将整个应用程序编写两次,一个写给Android,另一个写给IOS。

Is there a way to do it? 有办法吗?

Thank you. 谢谢。

If you have a native way in iOS and both Android you should wrap these as native modules and then include them in the project. 如果您在iOS和Android上都有本机方式,则应将它们包装为本机模块,然后将其包含在项目中。

Follow this guide here on the Community wiki -> https://wiki.appcelerator.org/display/guides2/Creating+a+New+Titanium+Module 在社区Wiki-> https://wiki.appcelerator.org/display/guides2/Creating+a+New+Titanium+Module上遵循此指南。

Then you can write a function that wraps the modules and returned the processed object. 然后,您可以编写一个包装模块并返回已处理对象的函数。 eg. 例如。

var processImage = function() {
    if (Titanium.Platform.name == 'android') {
        // Android stuff

        var imageProcess = require('ti.imageProcess');

        return imageProcess.doImage('/voo/bar', /*more options */)
    } else {
        // etc
    }
};

Instead of writing and maintaining two modules you could use a webView and use a JS library or the canvas object to pixelate the image. 无需编写和维护两个模块,您可以使用webView并使用JS库或canvas对象对图像进行像素化。

A JS canvas solution to this can be found here: 可以在这里找到JS canvas解决方案:

https://stackoverflow.com/a/19129822/2132015 https://stackoverflow.com/a/19129822/2132015

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Appcelerator Titanium图片和ico android - Appcelerator Titanium image and ico android 带图像的Appcelerator Titanium UI文本字段 - Appcelerator Titanium UI textfield with image 在Appcelerator Titan中将Blob转换为位图图像 - Convert blob to bitmap image in Appcelerator titanium Appcelerator Titanium:Facebook图片上传失败 - Appcelerator Titanium: Facebook Image Upload fail 钛/合金/加速器:图像覆盖整个屏幕 - Titanium/ Alloy/ Appcelerator: Cover entire screen with image Titanium Appcelerator图像上传问题,当呼叫服务没有图像时 - Titanium Appcelerator image upload issue When call service without image 是否可以使用Titan Appcelerator将文件直接上传到Amazon S3? - Is it possible to upload files directly to Amazon S3 using titanium appcelerator? 在Android(Titanium Appcelerator)中使用Sanselan从图像获取元数据 - Getting metadata from image using Sanselan in android(Titanium Appcelerator) 如何将二元数据字符串转换为钛制Appcelerator中的图像? - how to convert binary data string into image in titanium appcelerator? Titanium appcelerator图像视图加载事件监听器不能与android一起使用 - Titanium appcelerator image view load event listener not working with android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM