Blackberry Messenger のアニメーション GIF を作成する方法を知りたいのですが、Total Video Converter を使用してビデオをアニメーション GIF に変換しました。Blackberry の画像ディレクトリでは GIF 画像として正しく表示されますが、Blackberry Messenger の表示画像として使用すると表示されます。再生されず、位置がずれているように見えます。いくつかのブラックベリー メッセンジャーのアニメーション gif 表示画像が適切に表示されるのを見てきました (つまり、再生され、適切に位置合わせされている)。ブラックベリー メッセンジャーの表示画像として再生されるビデオからアニメーション gif を作成する方法はありますか?
4 に答える
あなたがしなければならないのは..
まだお持ちでない場合は、フォトスケープをダウンロードしてください http://www.photoscape.org/ps/main/download.php << これは安全です.. ここに画像の説明を入力してください
それを開き、[gif を作成] を押して、そこに写真をドラッグします。
あなたの写真を手に入れたら。サイズを押して、「キャンバスサイズを設定」を選択します
with と height の両方を 150 以下に設定し、gif は正方形でなければなりません。次に、それをブラックベリーに保存すると、動作するはずです
BlackBerry スマートフォン アプリケーション プログラミング インターフェイス (API) セット内の BitmapField を使用して画像を表示できます。ただし、アニメーション GIF の最初のフレームのみが表示されます。Web コンテンツ内のアニメーション GIF は、ブラウザー フィールドを使用して表示できます。ただし、アニメーション イメージのみを表示する必要がある場合は、アプリケーションに不要なオーバーヘッドが発生する可能性があります。
次のサンプルでは、BitmapField を拡張して、AnimatedGIFField という新しいクラスを作成します。このクラスは Screen に追加でき、アニメーション化する GIFEncodedImage を受け入れます。
/A field that displays an animated GIF.
public class AnimatedGIFField extends BitmapField
{
private GIFEncodedImage _image; //The image to draw.
private int _currentFrame; //The current frame in
the animation sequence.
private int _width; //The width of the image
(background frame).
private int _height; //The height of the image
(background frame).
private AnimatorThread _animatorThread;
public AnimatedGIFField(GIFEncodedImage image)
{
this(image, 0);
}
public AnimatedGIFField(GIFEncodedImage image, long style)
{
//Call super to setup the field with the specified style.
//The image is passed in as well for the field to
//configure its required size.
super(image.getBitmap(), style);
//Store the image and it's dimensions.
_image = image;
_width = image.getWidth();
_height = image.getHeight();
//Start the animation thread.
_animatorThread = new AnimatorThread(this);
_animatorThread.start();
}
protected void paint(Graphics graphics)
{
//Call super.paint. This will draw the first background
//frame and handle any required focus drawing.
super.paint(graphics);
//Don't redraw the background if this is the first frame.
if (_currentFrame != 0)
{
//Draw the animation frame.
graphics.drawImage(_image.getFrameLeft(_currentFrame), _image.getFrameTop(_currentFrame),
_image.getFrameWidth(_currentFrame), _image.getFrameHeight(_currentFrame), _image, _currentFrame, 0, 0);
}
}
//Stop the animation thread when the screen the field is on is
//popped off of the display stack.
protected void onUndisplay()
{
_animatorThread.stop();
super.onUndisplay();
}
//A thread to handle the animation.
private class AnimatorThread extends Thread
{
private AnimatedGIFField _theField;
private boolean _keepGoing = true;
private int _totalFrames; //The total number of
frames in the image.
private int _loopCount; //The number of times the
animation has looped (completed).
private int _totalLoops; //The number of times the animation should loop (set in the image).
public AnimatorThread(AnimatedGIFField theField)
{
_theField = theField;
_totalFrames = _image.getFrameCount();
_totalLoops = _image.getIterations();
}
public synchronized void stop()
{
_keepGoing = false;
}
public void run()
{
while(_keepGoing)
{
//Invalidate the field so that it is redrawn.
UiApplication.getUiApplication().invokeAndWait(new Runnable()
{
public void run()
{
_theField.invalidate();
}
});
try
{
//Sleep for the current frame delay before
//the next frame is drawn.
sleep(_image.getFrameDelay(_currentFrame) * 10);
}
catch (InterruptedException iex)
{} //Couldn't sleep.
//Increment the frame.
++_currentFrame;
if (_currentFrame == _totalFrames)
{
//Reset back to frame 0 if we have reached the end.
_currentFrame = 0;
++_loopCount;
//Check if the animation should continue.
if (_loopCount == _totalLoops)
{
_keepGoing = false;
}
}
}
}
}
}
注:プロジェクトに追加された画像は、アプリケーションが にビルドされるときに にautomatically
変換されます。これにより、アニメーション GIF を追加するときに問題が発生する可能性があります。このプロセスではアニメーションが削除されるためです。この問題には 2 つの回避策があります。Portable Network Graphics (PNG) format
.cod file
1 つ目は、BlackBerry® Java® Development Environment (BlackBerry JDE) でアプリケーションのプロジェクト プロパティを開き、[コンパイル] タブをクリックして、[画像ファイルを png に変換しない] チェックボックスをオンにします。これにより、アプリケーション内のすべての画像が変換されなくなります。これは、プロジェクトに GIF および PNG 以外の形式の画像がある場合、非効率になる可能性があります。
個々の画像の回避策は、GIF 画像の拡張子を .gif から別のもの (.bin など) に変更することです。これにより、RIM アプリケーション プログラム コンパイラ (RAPC) が画像を .png に変換できなくなります。
これを .java ファイルとしてここからダウンロードすることもできます
GIFキャンバスは正方形である必要があり、そのサイズは31Kbを超えてはなりません。
古いものですが、参考までに、 http: //www.flashdp.net でオンラインで無料で bbm ディスプレイのアニメーション画像を作成できます。