/*
Find out if embed object is image type or not.
771639
public static function embedTagIsImageByNode( $xmlNode )
    {
        $objectID  = $xmlNode->getAttribute( 'object_id' );
        $nodeID    = $xmlNode->getAttribute( 'node_id' );
        $object    = false;
        $classIdentifier = false;

        if ( is_numeric( $objectID ) )
        {
            $object = eZContentObject::fetch( $objectID );
        }
        elseif ( is_numeric( $nodeID ) )
        {
            $node = eZContentObjectTreeNode::fetch( $nodeID );
            if ( $node instanceof eZContentObjectTreeNode )
                $object = $node->object();
        }

        if ( $object instanceof eZContentObject )
        {
            $classIdentifier = $object->attribute( 'class_identifier' );
        }

        return $classIdentifier && self::embedTagContentType(  $classIdentifier ) === 'images';
    }
872207
def check_image_is_3d(img):
    """"""

    if len(img.shape) < 3:
        raise ValueError('Input volume must be atleast 3D!')
    elif len(img.shape) == 3:
        for dim_size in img.shape:
            if dim_size < 1:
                raise ValueError('Atleast one slice must exist in each dimension')
    elif len(img.shape) == 4:
        if img.shape[3] != 1:
            raise ValueError('Input volume is 4D with more than one volume!')
        else:
            img = np.squeeze(img, axis=3)
    elif len(img.shape) > 4:
        raise ValueError('Invalid shape of image : {}'.format(img.shape))

    return img
1177361
def IsPrimitiveType(obj):
   """"""
   return (isinstance(obj, types.bool) or isinstance(obj, types.byte) or
      isinstance(obj, types.short) or isinstance(obj, six.integer_types) or
      isinstance(obj, types.double) or isinstance(obj, types.float) or
      isinstance(obj, six.string_types) or
      isinstance(obj, types.PropertyPath) or
      isinstance(obj, types.ManagedMethod) or
      isinstance(obj, types.datetime) or
      isinstance(obj, types.URI) or isinstance(obj, type))
377863
function isFlat(object) {
  return isObject(object) && (isNull(Object.getPrototypeOf(object)) ||
                              isNull(Object.getPrototypeOf(
                                     Object.getPrototypeOf(object))));
}
947957
function maybeTriggerImageLoad(image, event) {
  if (!image.getAttribute('data-loaded') && isElementVisible(image)) {
    image.dispatchEvent(event);

    return true;
  }

  return false;
}
941327
private function _checkImage($img)
    {
        if (!file_exists($img)) {
            $this->_error = 'Image file dom\'t exists! file: ' . $img;
        } elseif (!($type = pathinfo($img, PATHINFO_EXTENSION)) || !self::isSupportedType($type)) {
            $this->_error = "Image type [$type] is not supported.";
        }

        return !$this->hasError();
    }
197218
private String guessImageFormat(String contentType, String imagePath) throws IOException {

        String format = "png";

        if (contentType == null) {
            contentType = URLConnection.guessContentTypeFromName(imagePath);
        }

        if (contentType != null) {
            format = contentType.replaceFirst("^image/([^;]+)[;]?.*$", "$1");
        }
        else {
            int queryStringIndex = imagePath.indexOf('?');

            if (queryStringIndex != -1) {
                imagePath = imagePath.substring(0, queryStringIndex);
            }

            String[] pathTokens = imagePath.split("\\.");

            if (pathTokens.length > 1) {
                format = pathTokens[pathTokens.length - 1];
            }
        }

        return format;
    }
194350
def check_animated(cls, raw_image):
        ""
        try:
            raw_image.seek(1)
        except EOFError:
            isanimated= False
        else:
            isanimated= True
            raise cls.AnimatedImageException
859335
function checkIsImage (src, onResult) {
  var request;

  if (src.tagName) {
    onResult(src.tagName === 'IMG');
    return;
  }
  request = new XMLHttpRequest();

  // Try to send HEAD request to check if image first.
  request.open('HEAD', src);
  request.addEventListener('load', function (event) {
    var contentType;
    if (request.status >= 200 && request.status < 300) {
      contentType = request.getResponseHeader('Content-Type');
      if (contentType == null) {
        checkIsImageFallback(src, onResult);
      } else {
        if (contentType.startsWith('image')) {
          onResult(true);
        } else {
          onResult(false);
        }
      }
    } else {
      checkIsImageFallback(src, onResult);
    }
    request.abort();
  });
  request.send();
}
762242
public function isImage() {
		try {
			if (!function_exists('exif_imagetype') && !function_exists('Jodit\exif_imagetype')) {
				function exif_imagetype($filename) {
					if ((list(, , $type) = getimagesize($filename)) !== false) {
						return $type;
					}

					return false;
				}
			}

			return in_array(exif_imagetype($this->getPath()), [IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP]);
		} catch (\Exception $e) {
			return false;
		}
	}
1077115
def _verify_shape_compatibility(self, img, img_type):
        """"""

        if self.input_image.shape[:-1] != img.shape:
            raise ValueError('Shape of the {} ({}) is not compatible '
                             'with input image shape: {} '
                             ''.format(img_type, img.shape, self.input_image.shape[:-1]))
1332438
public static boolean isCastableToImage(PageContext pc, Object obj) {
	try {
	    Class clazz = ImageUtil.getImageClass();
	    if (clazz != null) {
		Method m = clazz.getMethod("isCastableToImage", new Class[] { PageContext.class, Object.class });
		return (boolean) m.invoke(null, new Object[] { pc, obj });
	    }
	}
	catch (Exception e) {}
	return false;
    }
669011
function isImage(node) {
  return (
    node.nodeName === META
    && node.attrs.find(({ name, value }) => {
      value = value.trim();
      return name === 'itemprop' && value === 'image';
    })
  );
}
274786
@Override
	public String getMimeType() {
		String contentType = backing.getContentType();

		// IE6 (and apparently IE7) are broken and send the MIME type "image/pjpeg"
		// regardless of whether the image is a progressive jpeg or not. Sending the
		// incorrect MIME type back can cause display issues. It is always safe to
		// change it to just be "image/jpeg".
		if ("image/pjpeg".equals(contentType)) {
			contentType = "image/jpeg";
		}

		return contentType;
	}
1071768
public function checkPageSubjectInImageAltTags() {

        $html = $this->getPageContent();

        // for newly created page
        if ($html == '') {
            return false;
        }

        $dom = $this->createDOMDocumentFromHTML($html);

        $images = $dom->getElementsByTagName('img');

        foreach($images as $image){
            if($image->hasAttribute('alt') && $image->getAttribute('alt') != ''){
                if (preg_match('/' . preg_quote($this->owner->SEOPageSubject, '/') . '/i', $image->getAttribute('alt'))) {
                    return true;
                }
            }
        }

        return false;
    }
179434
def is_valid_image(self, raw_data):
        '''
        
        '''

        try:
            Image(blob=raw_data)
            return True
        except (exceptions.CorruptImageError, exceptions.MissingDelegateError):
            return False
1363876
public boolean isSameType( ImageType o ) {
		if( family != o.family )
			return false;
		if( dataType != o.dataType)
			return false;
		if( numBands != o.numBands )
			return false;
		return true;
	}