Image Asset Handling via Google Ads API

137 views
Skip to first unread message

Amit Tomar

unread,
May 16, 2025, 7:33:22 AM5/16/25
to Google Ads API and AdWords API Forum

Hi Team,

I have a few questions regarding image asset handling in the Google Ads API:

  1. Is there any API or utility provided by Google Ads to automatically crop or resize an image to meet the required aspect ratios for different ad types (e.g., for marketing_images, square_marketing_images, etc.)?

  2. Is there any field or API method available to get a hash or checksum of an image asset (either before or after upload)?

  3. Before uploading an image asset, is there a way to check if an asset with the same content already exists in the account (based on content hash or similar)?

Looking forward to your clarification.

Thank you!

Google Ads API Forum Advisor

unread,
May 16, 2025, 12:33:37 PM5/16/25
to amittomar...@gmail.com, adwor...@googlegroups.com

Hi,

Thank you for reaching out to the Google Ads API support team.

Please find the below answers for your questions:

1.Kindly note that it’s not possible to crop or resize an image to meet the required aspect ratios for different ad types through the Google Ads API. Please be informed that you can crop images using the image picker during implementation. I would recommend you to refer to the Image assets format requirements help center article for more detailed information.

2.Please note that it’s not possible to get a hash or checksum of an image asset through the Google Ads API. Kindly note that you can hash your image yourself using the SHA256 algorithm, or Google Ads will hash the data for you using the same SHA256 algorithm, which is the industry standard for one-way hashing. I would recommend you to refer this help center article for more information.

3.If you upload an image asset that has the same content with the existing image asset in your account then you will get a DUPLICATE_ASSET error. If you get this error while uploading the image asset, then you will know that an already existing asset with the same content is in your account.

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5
[2025-05-16 16:32:34Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01qXEO2:ref" (ADR-00306241)



Amit Tomar

unread,
May 19, 2025, 1:57:02 AM5/19/25
to Google Ads API and AdWords API Forum

I followed the official sample from your docs: https://developers.google.com/google-ads/api/samples/upload-image-asset

I uploaded the same image content multiple times, and the API returned the same resource name each time — without any DUPLICATE_ASSET error.

Just to confirm:

  • Is this the expected behaviour when the same image content is uploaded again?

  • Also, how can we confirm before uploading whether an identical image asset already exists in the account?

Thanks

Google Ads API Forum Advisor

unread,
May 19, 2025, 4:53:19 AM5/19/25
to amittomar...@gmail.com, adwor...@googlegroups.com

Hi,

Please find answers to your questions:

  • Is this the expected behavior when the same image content is uploaded again?

          Yes, this is an expected behavior when the same image content is uploaded again and you will not get any DUPLICATE_ASSET error.

  • Also, how can we confirm before uploading whether an identical image asset already exists in the account?

           You can use the below query to check if an asset already exists before uploading:

SELECT asset.resource_name, asset.name, asset.image_asset.mime_type, asset.image_asset.full_size.height_pixels, asset.image_asset.full_size.width_pixels, asset.image_asset.file_size FROM asset WHERE asset.type = 'IMAGE' AND asset.id = <Insert asset ID>

Additionally, I would suggest you go through the asset documentation for available fields/Metrics. Also, you can use Query Builder to create your query and Query Validator to validate your query.

 

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5

[2025-05-19 08:52:30Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01qXEO2:ref" (ADR-00306241)



Amit Tomar

unread,
May 19, 2025, 5:15:08 AM5/19/25
to Google Ads API and AdWords API Forum

Thank you for the clarification.

Yes, we did follow the same behavior — upon uploading identical image content, a new asset was not created, and no DUPLICATE_ASSET error was returned, as expected.

We also reviewed the asset query method you shared. However, it seems this approach requires us to know the asset.id beforehand. Since we are uploading from a new image file, we may not have that ID in advance.

Could you please confirm —
Is there a way to identify if an identical image asset already exists before uploading?

Looking forward to your confirmation.

Amit Tomar

unread,
May 19, 2025, 2:09:56 PM5/19/25
to Google Ads API and AdWords API Forum
any update?

Google Ads API and AdWords API Forum

unread,
May 19, 2025, 8:06:10 PM5/19/25
to Google Ads API and AdWords API Forum

Hi,

To find the duplicate image asset, you can pull an asset report and filter for dimensions and size and other attributes of the image you are trying to upload, and then if there is one match, you get the resource name. If you got the resource, it means that there exists an image asset; otherwise, it is a new image asset. You can utilize the below query.

  • SELECT asset.id, asset.image_asset.file_size, asset.image_asset.full_size.height_pixels, asset.image_asset.full_size.url, asset.image_asset.full_size.width_pixels, asset.image_asset.mime_type, asset.name, asset.resource_name FROM asset WHERE asset.image_asset.file_size = 0 AND asset.image_asset.full_size.height_pixels = 0 AND asset.image_asset.full_size.url = '0' AND asset.image_asset.full_size.width_pixels = 0 AND asset.image_asset.mime_type = 'IMAGE_GIF'

I hope it helps.

Thanks, 

Google Ads API support team.


Reply all
Reply to author
Forward
0 new messages