Add image dimensions
770274
def get_template_data(self, request, *args, **kwargs):
        ''''''

        # little tricky with vertical centering
        dimension = int(self.get_size().split('x')[0])

        data = {}

        if dimension <= 356:
            data['image_dimension'] = "row-md-13"

        if self.get_template_name().name.split("/")[-1] == "directories.html":
            data['directories'] = self.get_directories(request)

        return data
581445
def _generate_art(self, image, width, height):
        
        image = image.resize((width, height), Image.ANTIALIAS).convert("RGB")
        pixels = list(image.getdata())

        for y in range(0, height - 1, 2):
            for x in range(width):
                i = y * width + x
                bg = rgb2short(*(pixels[i]))
                fg = rgb2short(*(pixels[i + width]))
                yield (fg, bg)
629070
def resize(self, width=None):
        
        (iw, ih) = self.size
        if width is None:
            width = min(iw, utils.term.width)
        elif isinstance(width, basestring):
            percents = dict([(pct, '%s%%' % (pct)) for pct in range(101)])
            width = percents[width]
        height = int(float(ih) * (float(width) / float(iw)))
        height //= 2
        self.img = self.img.resize((width, height))
793804
function resizeImage(img, max_width, max_height) {
    var sizes = this.getImageNewAspectSizes(img, max_width, max_height);
    var width = sizes.width;
    var height = sizes.height;
    var canvas = this.imageToCanvas(img, width, height);
    return canvas;
    //return this.getImageByCanvas(canvas);
  }
363478
function() {
		this.width = 256;
		this.height = 224;
		this.data = new Uint8Array( this.width * this.height * 4 );

		for ( var i = 0; i < this.data.length; i++  ) {
			this.data[ i ] = 0xff;
		}

		this.context = getContext( this.el );
		this.image = this.context.getImageData( 0, 0, this.width, this.height );

		this.index = 0;
	}
349300
function (src, x, y, width, height) {
		var obj = this.createElement('img')
			.attr({ src: src });

		if (arguments.length > 1) {
			obj.css({
				left: x,
				top: y,
				width: width,
				height: height
			});
		}
		return obj;
	}
549542
function resizeImage(ctx, imageData, width, height) {
  const {naturalWidth, naturalHeight} = imageData;
  if (width === naturalWidth && height === naturalHeight) {
    return imageData;
  }

  ctx.canvas.height = height;
  ctx.canvas.width = width;

  ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);

  // image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight
  ctx.drawImage(imageData, 0, 0, naturalWidth, naturalHeight, 0, 0, width, height);

  return ctx.canvas;
}
517086
public static function get_dimensions_for_size( $img_size ) {
		$width  = absint( $img_size['resize'][0] );
		$height = isset( $img_size['resize'][1] ) ? absint( $img_size['resize'][1] ) : 0;

		return array( $width, $height );
	}
757077
private function addImageSizes()
    {
        $data = $this->getData();
        foreach ($data as $slug => $props)
        {
            add_image_size($slug, $props['width'], $props['height'], $props['crop']);
        }
    }
1006967
def _do_scale(image, size):
  """"""
  shape = tf.cast(tf.shape(image), tf.float32)
  w_greater = tf.greater(shape[0], shape[1])
  shape = tf.cond(w_greater,
                  lambda: tf.cast([shape[0] / shape[1] * size, size], tf.int32),
                  lambda: tf.cast([size, shape[1] / shape[0] * size], tf.int32))

  return tf.image.resize_bicubic([image], shape)[0]
787127
def addImgStream(self, img):
        '''
        
        '''
        if self.findCount > self.max_images:
            raise EnoughImages('have enough images')
        return self.addImg(img)
435677
private function calculateDimensions()
	{
		# calculate capatcha text box dimensions
		# which are the minimum image resource dimensions
	
		$this->_calculated_text_box['dimensions'] = $this->getTextBoxDimensions(
														$this->_background_text['size'],
														0,
														$this->_background_text['font'],
														$this->_code
														);

		# calculate how much each character takes from width
		$this->_calculated_text_box['char_width'] = $this->_calculated_text_box['dimensions']['width'] / $this->_code_length;

		# calculate additional width to add to the minimum text box width later
		$this->_calculated_text_box['additional_width'] = $this->_calculated_text_box['char_width'] * $this->_code_length + $this->_blocks_seperation;

		$this->_calculated_text_box['additional_height'] = rand( 5, 15 );	
		
		# set Initial Image Information width, height
		
		$this->_image_info['width']  = $this->_calculated_text_box['dimensions']['width']  + $this->_calculated_text_box['additional_width'];
			
		$this->_image_info['height'] = $this->_calculated_text_box['dimensions']['height'] + $this->_calculated_text_box['additional_height'];
		
		
		# Method End
	}
897242
function setCanvasSize (width, height) {
            canvas.setAttribute('width', width);
            canvas.setAttribute('height', height);
            canvas.style.width = width + 'px';
            canvas.style.height = height + 'px';
        }
714746
def add_image(self, filename, *, width=NoEscape(r'0.8\textwidth'),
                  placement=NoEscape(r'\centering')):
        

        if width is not None:
            if self.escape:
                width = escape_latex(width)

            width = 'width=' + str(width)

        if placement is not None:
            self.append(placement)

        self.append(StandAloneGraphic(image_options=width,
                                      filename=fix_filename(filename)))
1113145
function loadLargerImgSrc(img, largerSize) {
  if (img._preloaded) {
    return;
  }

  const dummyImg = new Image();
  dummyImg.srcset = img.srcset;
  dummyImg.sizes = largerSize;

  img._preloaded = true;
}
1265497
def getDimensionForImage(filename, maxsize):
    """"""
    try:
        from PIL import Image
    except ImportError:
        return None
    img = Image.open(filename)
    width, height = img.size
    if width > maxsize[0] or height > maxsize[1]:
        img.thumbnail(maxsize)
        out.info("Downscaled display size from %s to %s" % ((width, height), img.size))
    return img.size
734908
def get_image_dimensions(request):
        
        if request.service_type is ServiceType.WCS or (isinstance(request.size_x, int) and
                                                       isinstance(request.size_y, int)):
            return request.size_x, request.size_y
        if not isinstance(request.size_x, int) and not isinstance(request.size_y, int):
            raise ValueError("At least one of parameters 'width' and 'height' must have an integer value")
        missing_dimension = get_image_dimension(request.bbox, width=request.size_x, height=request.size_y)
        if request.size_x is None:
            return missing_dimension, request.size_y
        if request.size_y is None:
            return request.size_x, missing_dimension
        raise ValueError("Parameters 'width' and 'height' must be integers or None")