Tombloo + 画像処理
ImageProcessing.jsをTomblooで使ってみる。
- スクリプトディレクトリにimage_processing.jsを保存。
- extractorを書いてスクリプトディレクトリに保存。
例
Tombloo.Service.extractors.register({ name : 'Photo - Filter', ICON : 'chrome://tombloo/skin/photo.png', check : function(ctx){ return ctx.onImage; }, extract : function(ctx){ return succeed() .addCallback(function(){ var ip = ImageProcessing.load(ctx.imageURL); // 画像処理 ip.lock() .filter(ImageProcessing.filter.outline) .update(); return ip.data(); }) .addCallback(function(image){ return download(image, getTempDir(uriToFileName(ctx.href) + '.png')); }) .addCallback(function(file){ return { type : 'photo', item : ctx.title, file : file, }; }); } });
- 環境をリロードして 「Share」 > 「Photo - Filter」 (処理に時間がかかる)
データを加工して公開まで簡単にできる。