Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's really quite easy, just not very intuitive.</p> <p>You need to extend <code>ImageTranscoder</code>. In the <code>createImage</code> method you allocate a <code>BufferedImage</code>, cache it as a member variable, and return it. The <code>writeImage</code> method is empty. And you'll need to add a getter to retrieve the <code>BufferedImage</code>.</p> <p>It will look something like this:</p> <pre><code> class MyTranscoder extends ImageTranscoder { private BufferedImage image = null; public BufferedImage createImage(int w, int h) { image = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); return image; } public void writeImage(BufferedImage img, TranscoderOutput out) { } public BufferedImage getImage() { return image; } } </code></pre> <p>Now, to create an image you create an instance of your transcoder and pass it the desired width and height by setting <code>TranscodingHints</code>. Finally you transcode from a TranscoderInput to a null target. Then call the getter on your transcoder to obtain the image.</p> <p>The call looks something like this:</p> <pre><code> MyTranscoder transcoder = new MyTransCoder(); TranscodingHints hints = new TranscodingHints(); hints.put(ImageTranscoder.KEY_WIDTH, width); hints.put(ImageTranscoder.KEY_HEIGHT, height); transcoder.setTranscodingHints(hints); transcoder.transcode(new TranscoderInput(url), null); BufferedImage image = transcoder.getImage(); </code></pre> <p>Simple, right? (Yeah, right. Only took me 2 weeks to figure that out. Sigh.)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload