Skip to content

5.2. Google Images

Javinator9889 edited this page Aug 13, 2018 · 6 revisions
  • withImageParams(self, params: GoogleImages): defines the ImageParams for doing a search at Google Images. A GoogleImages object must be created.

GoogleImages

from pyGle.values import GoogleImages
  • setColor(self, color: AvailableColors): set the color of the image. The list of the colors is at AvailableColors.
  • setColorType(self, color_type: AvailableColorsType): set the color type of the image. The list of the color types is at AvailableColorTypes.
  • setImageRights(self, rights: AvailableRights): looks for images that has these rights. The list of the rights is at AvailableRights.
  • setImageSize(self, size: AvailableSizes): looks for images with the specified size. The list of the sizes is at AvailableSizes.
  • setImageType(self, image_type: AvailableImagesTypes): finds images that are of the specified image type. The list of the images types is at AvailableImageTypes.
  • setAspectRatio(self, aspect_ratio: AvailableAspectRatios): finds images that have the specified aspect ratio. The list of the aspect ratios is at AvailableAspectRatios.
  • setImageFormat(self, image_format: AvailableImageFormats): looks for images that have the specified format. The list of the formats is at AvailableImageFormats.

List output format

Here is the format of the results, when job finishes:

[    {
          'url': 'image URL',
          'format': 'image format',
          'id': 'image ID',
          'source': 'image source',
          'width': 'image width',    # int value
          'height': 'image height',  # int value
          'posted_on': 'image posted on',
          'website_name': 'image website name',
          'webpage_name': 'webpage name',
          'webpage_title': 'webpage title'
     },
     {
          'stats':    {
                           'images_found': 'number of images found',
                           'overall_time': 'total time',
                           'google_search_time': 'time for searching at Google',
                           'parsing_page_time': 'time for parsing the results'
                      },
          'url': 'Google Images URL'
     }
]

<<< Previous page - Next page >>>