Skip to content

Commit 48b658d

Browse files
committed
Log warning if compressionQuality outside of range
1 parent 66b3b9f commit 48b658d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/vertexai/src/requests/imagen-image-format.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* limitations under the License.
1616
*/
1717

18+
import { logger } from "../logger";
19+
1820
export class ImagenImageFormat {
1921
mimeType: string;
2022
compressionQuality?: number;
@@ -24,6 +26,9 @@ export class ImagenImageFormat {
2426
}
2527

2628
static jpeg(compressionQuality?: number): ImagenImageFormat {
29+
if (compressionQuality && (compressionQuality < 0 || compressionQuality > 100)) {
30+
logger.warn(`Invalid JPEG compression quality of ${compressionQuality} specified; the supported range is [0, 100].`);
31+
}
2732
return { mimeType: 'image/jpeg', compressionQuality };
2833
}
2934

0 commit comments

Comments
 (0)