1

SVG ファイルを JPEG に変換するには、次のリンクを参照しました。

http://xmlgraphics.apache.org/batik/using/transcoder.html

そして、以下は私が試したサンプル例です:

import java.io.*;

import org.apache.batik.transcoder.image.JPEGTranscoder;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;

public class SaveAsJPEG {

    public static void main(String[] args) throws Exception {

        // Create a JPEG transcoder
        JPEGTranscoder t = new JPEGTranscoder();

        // Set the transcoding hints.
        t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,
                   new Float(.8));

        // Create the transcoder input.
        String svgURI = new File(args[0]).toURL().toString();
        TranscoderInput input = new TranscoderInput(svgURI);

        // Create the transcoder output.
        OutputStream ostream = new FileOutputStream("out.jpg");
        TranscoderOutput output = new TranscoderOutput(ostream);

        // Save the image.
        t.transcode(input, output);

        // Flush and close the stream.
        ostream.flush();
        ostream.close();
        System.exit(0);
    }
}

上記のプログラムは、プロジェクト パスにファイルの JPEG バージョンを作成します。このプログラムを調整して、JCIFS (SmbFile) の概念を使用して、保護された共有フォルダーに変換されたファイルを読み取って作成する可能性はありますか?

4

0 に答える 0