# Class ComponentImage.EncodedWrapper

java.lang.Object
com.codename1.ui.Image
com.codename1.ui.EncodedImage
com.codename1.ui.ComponentImage.EncodedWrapper

All Implemented Interfaces:
  `ActionSource`

Enclosing class:
  `ComponentImage`

public class ComponentImage.EncodedWrapper extends EncodedImage
A wrapper for ComponentImage to convert it to an EncodedImage.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected Image`
  `getInternal()`
  Returns the actual image represented by the encoded image, this image will be cached in a weak/soft reference internally.
  `Image`
  `scaled(int width, int height)`
  Returns a scaled version of this image image using the given width and height, this is a fast algorithm that preserves translucent information.
  `EncodedImage`
  `scaledEncoded(int width, int height)`
  Performs scaling using ImageIO to generate an encoded Image

  ### Methods inherited from class EncodedImage

  `asyncLock, create, create, create, create, create, createFromImage, createFromRGB, createMulti, drawImage, drawImage, getGraphics, getHeight, getImage, getImageData, getWidth, isAnimation, isLocked, isOpaque, lock, modifyAlpha, modifyAlpha, resetCache, rotate, scale, scaledHeight, scaledSmallerRatio, scaledWidth, subImage, toRGB, unlock`

  ### Methods inherited from class Image

  `addActionListener, animate, applyMask, applyMask, applyMaskAutoScale, createImage, createImage, createImage, createImage, createImage, createImage, createImage, createIndexed, createMask, createSVG, dispose, exifRotation, exifRotation, exifRotation, fill, fireChangedEvent, flipHorizontally, flipVertically, getExifOrientationTag, getExifOrientationTag, getImageName, getRGB, getRGB, getRGBCached, getSVGDocument, isAlphaMutableImageSupported, isJPEG, isPNG, isSimdOptimizationsEnabled, isSVG, isSVGSupported, mirror, modifyAlphaWithTranslucency, removeActionListener, requiresDrawImage, resetSimdOptimizationsEnabled, rotate180Degrees, rotate270Degrees, rotate90Degrees, scaledLargerRatio, setImageName, setSimdOptimizationsEnabled`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### scaledEncoded

    public EncodedImage scaledEncoded(int width, int height)

    Performs scaling using ImageIO to generate an encoded Image

    ###### Parameters

    - `width`: the width of the image, -1 to scale based on height and preserve aspect ratio

    - `height`: the height of the image, -1 to scale based on width and preserve aspect ratio

    ###### Returns

    new encoded image

    Overrides:
      `scaledEncoded` in class `EncodedImage`

  - ### scaled

    public Image scaled(int width, int height)

    Returns a scaled version of this image image using the given width and height, this is a fast algorithm that preserves translucent information. The method accepts -1 to preserve aspect ratio in the given axis.

    ###### Parameters

    - `width`: width for the scaling

    - `height`: height of the scaled image

    ###### Returns

    new image instance scaled to the given height and width

    Overrides:
      `scaled` in class `EncodedImage`

  - ### getInternal

    protected Image getInternal()

    Returns the actual image represented by the encoded image, this image will be cached in a weak/soft reference internally. This method is useful to detect when the system actually created an image instance. You shouldn't invoke this method manually!

    ###### Returns

    drawable image instance

    Overrides:
      `getInternal` in class `EncodedImage`