render identicon to PIL.Image

        @param size identicon patchsize. (image size is 3 * [size])
        @return PIL.Image
501058
def render(self, size):
        

        # decode the code
        middle, corner, side, foreColor, backColor = self.decode(self.code)
        size = int(size)
        # make image
        image = Image.new("RGB", (size * 3, size * 3))
        draw = ImageDraw.Draw(image)

        # fill background
        draw.rectangle((0, 0, image.size[0], image.size[1]), fill=0)

        kwds = {
            'draw': draw,
            'size': size,
            'foreColor': foreColor,
            'backColor': backColor}
        # middle patch
        self.drawPatch((1, 1), middle[2], middle[1], middle[0], **kwds)

        # side patch
        kwds['type'] = side[0]
        for i in range(4):
            pos = [(1, 0), (2, 1), (1, 2), (0, 1)][i]
            self.drawPatch(pos, side[2] + 1 + i, side[1], **kwds)

        # corner patch
        kwds['type'] = corner[0]
        for i in range(4):
            pos = [(0, 0), (2, 0), (2, 2), (0, 2)][i]
            self.drawPatch(pos, corner[2] + 1 + i, corner[1], **kwds)

        return image
244426
protected final BufferedImage create_LED_Image(final int SIZE, final int STATE, final LedColor LED_COLOR) {
        return LED_FACTORY.create_LED_Image(SIZE, STATE, LED_COLOR, model.getCustomLedColor());
    }
1250534
public static BufferedImage resize(BufferedImage image, int width, int height)
    {
        final int transparency = image.getColorModel().getTransparency();
        final BufferedImage resized = createImage(width, height, transparency);
        final Graphics2D g = resized.createGraphics();

        optimizeGraphicsSpeed(g);
        g.drawImage(image, 0, 0, width, height, 0, 0, image.getWidth(), image.getHeight(), null);
        g.dispose();

        return resized;
    }
815545
protected IntBuffer createIntBuffer(int size) {
      ByteBuffer temp = ByteBuffer.allocateDirect(4 * size);
      temp.order(ByteOrder.nativeOrder());

      return temp.asIntBuffer();
    }
456780
@NonNull
    public IconicsDrawable paddingRes(@DimenRes int sizeResId) {
        return paddingPx(mContext.getResources().getDimensionPixelSize(sizeResId));
    }
784071
function(size) {
        OpenLayers.Renderer.prototype.setSize.apply(this, arguments);
        
        this.rendererRoot.setAttributeNS(null, "width", this.size.w);
        this.rendererRoot.setAttributeNS(null, "height", this.size.h);
    }
35166
public static Image imageFromString(String uri, int width, int height) {
        return imageFromMatrix(matrixFromString(uri, width, height));
    }
1099497
private String getIconPath(CmsObject cms, CmsUser user, IconSize size) {

        String userIconPath = (String)user.getAdditionalInfo(USER_IMAGE_INFO);
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(userIconPath)) {
            userIconPath += size.equals(IconSize.Big)
            ? ""
            : "?__scale=h:" + size.getSize() + ",w:" + size.getSize() + ",t:2";
            return OpenCms.getLinkManager().substituteLinkForRootPath(cms, userIconPath);
        }

        boolean isAdmin = OpenCms.getRoleManager().hasRole(cms, user.getName(), CmsRole.ADMINISTRATOR);
        String name = user.getName() + Boolean.toString(isAdmin);
        String rfsName = toRfsName(name, size);
        String path = toPath(name, size);
        if (!m_cache.hasCacheContent(rfsName)) {

            BufferedImage icon = m_renderer.render(name, isAdmin, size.getSize());
            try {
                m_cache.saveCacheFile(rfsName, getImageBytes(icon));
            } catch (Exception e) {
                LOG.error(e.getLocalizedMessage(), e);
            }
        }
        return path;
    }
1012731
public static ImageIcon getScaledIcon(URL url) {
		if (url == null) {
			return null;
		}
		return getScaledIcon(new ImageIcon(url));
	}
169741
public static GraphicInfo createGraphic(MarkInfo mark, int size) {
		GraphicInfo graphicInfo = new GraphicInfo();
		ChoiceInfo choice = new ChoiceInfo();
		choice.setMark(mark);
		graphicInfo.getChoiceList().add(choice);
		SizeInfo sizeInfo = new SizeInfo();
		sizeInfo.setValue(Integer.toString(size));
		graphicInfo.setSize(sizeInfo);
		return graphicInfo;
	}
1244519
def resize(self, image, size):
        
        (width, height, force) = size

        if image.size[0] > width or image.size[1] > height:
            if force:
                return ImageOps.fit(self.image, (width, height), Image.ANTIALIAS)
            else:
                thumb = self.image.copy()
                thumb.thumbnail((width, height), Image.ANTIALIAS)
                return thumb

        return image
542639
@NonNull
    public IconicsDrawable sizeResX(@DimenRes int sizeResId) {
        return sizePxX(mContext.getResources().getDimensionPixelSize(sizeResId));
    }
425847
def resize(self, size):
        """"""
        return Image(self.pil_image.resize(size, PIL.Image.ANTIALIAS))
329480
protected void recreateUserLedImages(final int SIZE) {
        if (userLedImageOff != null) {
            userLedImageOff.flush();
        }
        userLedImageOff = create_LED_Image(SIZE, 0, model.getUserLedColor());

        if (userLedImageOn != null) {
            userLedImageOn.flush();
        }
        userLedImageOn = create_LED_Image(SIZE, 1, model.getUserLedColor());
    }
926959
private static int sizeToInt(String size) {
		int position = size.indexOf('p');
		if (position < 0) {
			return Integer.parseInt(size);
		}
		return Integer.parseInt(size.substring(0, position));
	}
72057
public Texture createTexture(final int width, final int height, final int filter) throws IOException {
    	ImageData ds = new EmptyImageData(width, height);
    	
    	return getTexture(ds, filter);
    }
192167
public void setIconSize(int size){
        mEmptyIconSize = size;
        int width = mEmptyIconSize == -1 ? WRAP_CONTENT : mEmptyIconSize;
        int height = mEmptyIconSize == -1 ? WRAP_CONTENT : mEmptyIconSize;
        LinearLayout.LayoutParams iconParams = new LinearLayout.LayoutParams(width, height);
        mIcon.setLayoutParams(iconParams);
    }