A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-resize-image below:

The ML.RESIZE_IMAGE function | BigQuery

Stay organized with collections Save and categorize content based on your preferences.

The ML.RESIZE_IMAGE function

This document describes the ML.RESIZE_IMAGE scalar function, which lets you resize images by using bilinear interpolation. You can use ML.RESIZE_IMAGE with the ML.PREDICT function or chain it with other functions or subqueries.

Syntax
ML.RESIZE_IMAGE(image, target_height, target_width, preserve_aspect_ratio)
Arguments

ML.RESIZE_IMAGE takes the following arguments:

Output

ML.RESIZE_IMAGE returns a STRUCT value that represents the resized image, with the same form as the image input argument.

The first array in the struct represents the dimensions of the image, and the second array in the struct contains the image data, similar to the image input argument.

Note: If you reference ML.RESIZE_IMAGE in SQL statements in the BigQuery editor, it is possible for the function output to be too large to display. If this occurs, write the output to a table instead. Examples

Example 1

The following example resizes input images to have a height and width of 240 pixels:

CREATE OR REPLACE TABLE `mydataset.results`
AS (
  SELECT uri, prediction_results
  FROM
    ML.PREDICT(
      MODEL `mydataset.mymodel`,
      SELECT
        ML.RESIZE_IMAGE(ML.DECODE_IMAGE(data), 240, 240, FALSE)
        AS image,
        uri
      FROM `mydataset.images`)
);

Example 2

The following example resizes input images while preserving the aspect ratio. With the settings shown, the function returns an image with dimensions of (10, 100) for an input image with dimensions of (20, 200).

CREATE OR REPLACE TABLE `mydataset.results`
AS (
  SELECT uri, prediction_results
  FROM
    ML.PREDICT(
      MODEL `mydataset.mymodel`,
      SELECT
        ML.RESIZE_IMAGE(ML.DECODE_IMAGE(data), 10, 120, TRUE)
        AS image,
        uri
      FROM `mydataset.images`)
);
What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["The `ML.RESIZE_IMAGE` function resizes images using bilinear interpolation and can be used with the `ML.PREDICT` function or chained with other functions/subqueries."],["It accepts a `STRUCT` representing the image, target height, target width, and a boolean to preserve the aspect ratio."],["The image data within the `STRUCT` can be represented by `INT64` values between `[0, 255)` or `FLOAT64` values between `[0, 1)`, and the dimensions are specified by height, width, and number of channels."],["When `preserve_aspect_ratio` is `TRUE`, the function returns the largest image possible within the target dimensions while maintaining the original aspect ratio."],["The function outputs a `STRUCT` value representing the resized image, mirroring the input format."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4