JavaでPNGをPSDに変換する方法

Master how to convert [PNG]…

JavaでPNGをPSDに変換する手順

  1. PNG を PSD に変換するために、Aspose.PSD for Java を追加するよう環境を設定する
  2. FileStream クラスオブジェクトを使用してソース PNG ファイルをロードする
  3. PsdImage のオブジェクトを作成し、そのサイズを設定する
  4. Layer クラスのオブジェクトを宣言し、ロードした画像ストリームで初期化する
  5. このレイヤーオブジェクトを PSD オブジェクトに追加する
  6. 画像付きの PSD ファイルをディスクに保存する

これらの手順は、PNG to PSD file in Java を変換する方法を示しています。手順は、最初の PNG ファイルを FileStream に読み込むことから始まります。その後、PsdImage オブジェクトを作成し、Layer を宣言して設定します。この Layer は PSDImage に統合され、ディスクに保存されます。

PNG を PSD ファイルに変換する Java のコード

Now that you’ve seen the snippet, you have a fully‑functional PNG‑to‑PSD converter in Java. While the example handles a single PNG, scaling it up is straightforward—just open each image with a FileStream, create a matching layer, and add that layer to the same PSD document. The same technique works for BMP, JPEG, or any other format that can be read via a FileStream, allowing you to assemble rich, multi‑layer PSD files with ease.

You’re all set to convert PNG to PSD in Java. When you’re ready to transform a PSD file into a JPEG, dive into our detailed tutorial on how to convert PSD to JPEG in Java.

 日本語