我浏览了互联网但我找不到答案。我有一个pgm文件,我用它作为BufferedImage来进行卷积(我使用JAI),但是我将它保存回pgm文件时遇到了麻烦。 到目前为止,我使用以下代码保存:
JAI.create("filestore", newImage, outputFileName);
我得到了一个pgm文件,但是当我打开图像时,IfranView告诉我它是一个扩展名不正确的TIF文件。我需要改变什么?
我感谢任何帮助!如果可能,请提供代码示例。谢谢大家。
亲切的问候, Staniel
答案 0 :(得分:0)
public class SellFloatingBubbleService extends Service {
private WindowManager windowManager;
private ImageView imageView;
@Override
public void onCreate() {
super.onCreate();
imageView = new ImageView(this);
imageView.setImageResource(R.drawable.tabbar_tooltip_v3);
windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
final WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT,
LayoutParams.TYPE_PHONE,
LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT);
layoutParams.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
layoutParams.y = (int) TypedValue.applyDimension(TypedValue
.COMPLEX_UNIT_PX, getResources().getDimensionPixelOffset(R.dimen
.sell_button_height), getResources().getDisplayMetrics());
windowManager.addView(imageView, layoutParams);
imageView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
stopSelf();
return true;
}
});
/**
* When these animations will end they will revert and then play endlessly.
*/
AnimatorSet bouncer = new AnimatorSet();
ObjectAnimator animX = ObjectAnimator.ofFloat(imageView, "scaleX", 1f, 0.8f);
animX.setRepeatMode(ValueAnimator.REVERSE);
animX.setRepeatMode(-1);
ObjectAnimator animY = ObjectAnimator.ofFloat(imageView, "scaleY", 1f, 0.8f);
animY.setRepeatMode(ValueAnimator.REVERSE);
animY.setRepeatCount(-1);
bouncer.playTogether(animX, animY);
bouncer.setDuration(1000);
bouncer.setInterpolator(new AccelerateDecelerateInterpolator());
bouncer.start();
}
@Override
public void onDestroy() {
imageView.setVisibility(View.GONE);
windowManager.removeView(imageView);
super.onDestroy();
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
}
这应该采用缓冲图像(jpeg,png ...等)并将其正确转换为pgm。
编辑:允许.pgm文件与ImageIO一起使用的JAI插件可在http://www.oracle.com/technetwork/java/index.html
找到答案 1 :(得分:0)
答案 2 :(得分:0)
我找到了答案。我已将外部JAI图像添加到我的库中。
ImageIO.write(bufferedImage, "pnm", new File("output file directory.....image.pgm"));
而不是" pgm"它应该说" pnm"。新文件将自动具有pgm扩展名。
答案 3 :(得分:0)
也许迟到了,但我刚写了一篇。一个简单的PGM编写器采用2d双数组,其值在[0.0,1.0]范围内。
var ref = new Firebase("https://yourfirebase.firebaseio.com");
var authData = ref.getAuth();
if (authData) {
console.log("User " + authData.uid + " is logged in with " + authData.provider);
} else {
console.log("User is logged out");
}