惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Hacker News
The Hacker News
F
Full Disclosure
Cloudbric
Cloudbric
Blog — PlanetScale
Blog — PlanetScale
W
WeLiveSecurity
N
News and Events Feed by Topic
T
Troy Hunt's Blog
V2EX - 技术
V2EX - 技术
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
B
Blog
GbyAI
GbyAI
C
Check Point Blog
B
Blog RSS Feed
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Recorded Future
Recorded Future
The Last Watchdog
The Last Watchdog
N
News and Events Feed by Topic
T
The Blog of Author Tim Ferriss
O
OpenAI News
V
V2EX
人人都是产品经理
人人都是产品经理
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
WordPress大学
WordPress大学
www.infosecurity-magazine.com
www.infosecurity-magazine.com
S
Security @ Cisco Blogs
C
Cisco Blogs
Security Latest
Security Latest
S
Security Affairs
V
Visual Studio Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园 - 司徒正美
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
Last Week in AI
Last Week in AI
AWS News Blog
AWS News Blog
雷峰网
雷峰网
Apple Machine Learning Research
Apple Machine Learning Research
PCI Perspectives
PCI Perspectives
博客园_首页
U
Unit 42
Google DeepMind News
Google DeepMind News
Hugging Face - Blog
Hugging Face - Blog
Project Zero
Project Zero
Cisco Talos Blog
Cisco Talos Blog
The Register - Security
The Register - Security
N
Netflix TechBlog - Medium
L
LINUX DO - 热门话题
H
Hacker News: Front Page

ImageKit.io Blog

Next.js Image Optimization with ImageKit Use Video as a Background in Your Next.js Project How to Fix Autoplay Video in Next.js How Durian Scaled a Visual-First Retail Experience to 350K Monthly Visitors Online How Matsmart accelerated image delivery across countries with ImageKit AI in Digital Asset Management: From Smart Workflows to Agentic Automation How Joseph Joseph unified and secured global video delivery with ImageKit How Modall powers fast, effortless media delivery across 40+ projects with ImageKit Digital Asset Management (DAM) Trends: 2026 Report How to add a poster image to Video.js player (and automate it) HLS streaming with Video.js + React Building the future of storytelling with fast, AI-powered video delivery How PushOwl delivers 100M+ image-rich notifications seamlessly with ImageKit How Homify delivers millions of interior design images seamlessly with ImageKit Better event discovery with lightning‑fast videos & images Adding video player in React Native Video player in Angular applications Crop and resize videos in React Next.js image and video upload React image and video upload React video optimization How we quadrupled our traffic to 625K monthly page views How Apollo 24|7 boosted performance & reduced costs with ImageKit Simplify your media workflows with ImageKit DAM integrations Extending Lighthouse for custom image and video optimization analysis Brand Asset Management: What is it? How does it work? WordPress Digital Asset Management Guide - Manage your WP media assets better Why Shopify retailers need a digital asset management solution DAM vs. SharePoint: Which is best for you? AI-powered Metadata and Tagging in Digital Asset Management How Hopscotch built India's largest online Kids' fashion brand with ImageKit Dropbox Vs. DAM: Which Is The Right Tool For Digital Asset Management Digital Asset Management for Photographers: A Complete Guide Why digital asset management for agencies is essential Helping both Top and Bottom Line: SaffronStays rapid, profitable growth with ImageKit How KreditBee simplified media experiences with ImageKit Google Drive alternatives for businesses (with fast-growing teams) Node.js image upload ImageKit: The Secret Ingredient in Swiggy’s Expansion Journey Streamlining the Design Approval Process: A Comprehensive Guide AV1 Codec - Complete guide for video application devs PHP image and video upload Angular image & video upload AV1 vs VP9: Which codec should you choose? Adding video player in Next.js React Video Player VP8 vs VP9 - In the context of online video delivery Exploring WebM vs MP4 7 Free Digital Asset Management Software that are not Open-Source Comparing 9 Top Digital Asset Management Tools in the Market What are Brand Standards and Why do they Matter? Boost Sales and Brand Appeal: Essential Tips for eCommerce Image Management Brand Recall: The Strategy to Create Unforgettable Brands How to upload files in HTML? Branding for Small Businesses (2025 Edition) Everything you need to know about VP9 codec Recent updates from ImageKit and what's next Best Ways to Write RFP For Digital Asset Management (+ with free RFP template) What is Brand Dilution? How to Avoid It? Explained with [Examples] The Importance of Brand Identity: Leveraging Digital Asset Management for Impact From Launch to Scale: How to Launch a Brand Campaign Digital Asset Management Requirements - What do You Need to Evaluate and How? Marketing Collateral Management: A Quick End-to-End Guide Video Content Management System: What Is It And How To Choose One? Dropbox vs. Google Drive vs. Onedrive: The Best Cloud Storage Solution How to Build Brand Trust: Get Started In 2025 Google Drive vs. Box: A Detailed Comparison How Digital Asset Management Solutions Help Protect Brand Equity A DAM Solution Can Safeguard Your Digital Intellectual Property - Here’s How WebP Vs. PNG: Which Image Format Should You Use and Why? How to Resize Images in Bootstrap Easily Progressive jpegs (PJPEG): the key to loading images faster on your website Dropbox vs. Google Drive: The Best Cloud Storage For Digital Assets Dropbox Pros & Cons In 2024: An In-Depth Analysis and Why A DAM Solution Stands Out Google Drive Vs OneDrive: The Better Storage Option For Digital Assets Manage your video assets better with video metadata Understanding DAM's Role in Strengthening Brand Identity Digital asset management strategy: What to know before creating one The Ultimate Guide To Marketing Agency Onboarding 6 Solutions To Simplify Large File Sharing Over The Web A Step-by-Step Breakdown of a Video Production Workflow 13 Digital Asset Management Use Cases You Should Know How to Conduct a Brand Audit and Manage Your Brand Assets Costly Consequences of Inconsistent Branding And How DAM Can Help Dynamic Asset Transformation: What It Is, Why You Need It, and How ImageKit Can Help Everything You Need to Know About HTML Video Autoplay How To Select Your DAM Vendor: A Complete Guide How to Boost User Experience with Smart Digital Asset Management React Image Optimization: A Guide for Web Developers Why Should DAM Be A Part Of Your MarTech Stack? Unleashing the Power of Content Repurposing with ImageKit MKV vs MP4: Which Video File Format Is Better for Your Needs? Digital Asset Management For Ecommerce: A Complete Guide How an Image Tagging Software can Transform Your Image Search How to Manage Your Content Lifecycle Effectively M4V vs MP4: Which Video Format Should You Use and Why? Why Every Business Needs An Image Management System All The Questions To Ask During A Dam Demo Which is the Best Image Format for Your Website? Uploading Multiple Files Using JavaScript: A Comprehensive Guide
Optimize and resize images in Google Cloud Storage with ImageKit
Rahul Nanwani · 2021-07-30 · via ImageKit.io Blog

Google Cloud Platform (GCP) is the cloud computing offering from Google. It has emerged as a solid competitor to the cloud platforms offered by AWS and Microsoft Azure. One of the services in GCP is the object storage called Cloud Storage. It is similar to the offering from AWS S3 and helps you store your files in the cloud, and provides an instant, high availability storage with practically infinite scale.

Cloud Storage provides enterprise-grade object storage features and is available in multiple regions across the globe. A lot of companies use it to store images on the cloud. However, it has some drawbacks -

  1. Cloud Storage does not provide image optimization features like format conversion to WebP or AVIF.
  2. It cannot compress your images to make them suitable for delivery on the web.
  3. It does not offer real-time image manipulations to allow the delivery of responsive images across different devices.
We will optimize this image in Cloud Storage with ImageKit
We will optimize this image in Cloud Storage with ImageKit

With so many different user devices and users coming to expect nothing but high-quality experiences, real-time image optimizations and transformations are essential for every online business. Businesses try to work around these shortcomings by building solutions in-house.

But, let's be honest, as a business, you might not have the time and resources to dedicate to image delivery and optimization, amongst all the other product features.

This is where ImageKit comes in. It can integrate with your Google Cloud Storage and help you deliver perfectly optimized, responsive images across devices in minutes. You can get started for free on the forever free plan on ImageKit! Read on to see how you can do this.

What is ImageKit?

ImageKit is a cloud-based end-to-end image management and delivery service. It comes with its own storage and delivery CDN, along with more than 50 image and video transformations that can be performed in real-time.

Note: ImageKit comes with AWS CloudFront as its CDN out of the box. If you prefer using your own CDN like Google Cloud CDN with ImageKit, you can do so on its enterprise plan with assistance provided by ImageKit's support team. The features and integration with Cloud Storage demonstrated in this post remain the same, regardless of the CDN you choose.

The best part about ImageKit is that it is not necessary to use ImageKit's storage to use its optimization and transformation features. It can be integrated with any external storage, including Google Cloud Storage, to help you deliver lighter images in no time.

The same 2.5MB image shown above is optimized by ImageKit
The same 2.5MB image shown above is optimized by ImageKit

Over 35,000 developers and 600 companies use ImageKit to deliver billions of optimized images and videos every day.

Let's look at how you can use it with your Google Cloud storage.

Request flow for optimized images in Cloud Storage with ImageKit

  1. After attaching your Google Cloud Storage to ImageKit, you can access the image in it using the ImageKit URL endpoint.
  2. If ImageKit has a cached version of its CDN or other internal caches, it delivers the image from there. Such images get delivered in low double-digit milliseconds.
  3. Suppose ImageKit does not have the optimized and transformed image in its cache. In that case, ImageKit gets the original image from the storage attached to ImageKit, does all the processing in real-time, and sends back the right image to the user. This takes about 100-200ms on average, depending on the input image.
  4. Subsequent requests for the same image get served from ImageKit's CDN (or if you are using a custom CDN).
The request workflow with ImageKit and the cloud Storage attached to it
The request workflow with ImageKit and the cloud Storage attached to it

Let's look at the steps you need to follow to optimize and resize the images in your Cloud Storage via ImageKit.

Considering the rapidly changing features in both ImageKit and Google Cloud, always refer to the current technical documentation for this integration here.

We have created a new bucket in Cloud Storage for this article called test-imagekit-bucket and uploaded a few images to it. The bucket and the objects inside the bucket are Private, but the steps remain the same even if the objects are Public.

By the end of this article, we would be able to deliver high-quality, responsive images across devices using the original image stored in this storage.

1. Create an ImageKit Account

The first step, of course, is to create an ImageKit account. ImageKit offers a fully-featured, forever free account with 20GB of delivery bandwidth every month. This is usually more than enough for websites up to a few thousand page views in a month. You can go for higher plans if your delivery bandwidth requirement is higher than 20GB in a month.

ImageKit offers seven processing regions across the globe for optimization. You should choose the one that is geographically closest to your Cloud Storage bucket location.

2. Creating access keys to access the objects in the bucket

Since the images added to our Cloud Storage are private, we cannot access them via the object's URL. We need to create access keys in Google Cloud that will have access to read the files in our test bucket.

Note: If the objects in your bucket are public, i.e., you can access them via their URL, you can also use ImageKit's Web Server origin integration to attach your Cloud Storage to ImageKit.

a. Creating a Service Account in GCP

First, we need to create a new service account in Google Cloud. A service account is a special type of account created in Google Cloud to allow applications (in this case ImageKit), and not people, to access resources.

On the service accounts page, we created a new account with the name imagekit-integration

In the next step of creating the service account, attach the role "Storage Object Viewer" to the service account.

We can then save this service account.

b. Creating keys for the service account

Now that we have a service account in place, we need to create its keys, which we will then use to integrate the storage with ImageKit. To do this, go to the Keys section of the newly created service account. Click on "Add Key" and generate a JSON-type key. Once done, a JSON file containing the key will get downloaded to our system. Store this file securely as it contains the access keys to the bucket.

ImageKit supports integration directly via this JSON file, and we will use it in the next step.

3. Attaching your Cloud Storage to ImageKit

The next step is to attach your Cloud Storage bucket to ImageKit. This will allow ImageKit to access the original images from your bucket when needed.

To do this, go to “External Storage” in the ImageKit dashboard and click on the “Add New Origin” button. In the modal that opens up, select the “Origin Type" as “Google Cloud Storage”.

You can now fill up all the other fields in this modal like the Bucket Name, Bucket Folder (the folder you want to access in the bucket, we will use / because we want to access the entire bucket. Upload the JSON file containing the keys that we just downloaded.

ImageKit will automatically parse the file and fill in the fields for "Google Service Account Private Key" and "Google Service Account Client E-Mail", as shown below. Once done, click on "Submit" to add this bucket to ImageKit

ImageKit does not start copying the objects from your bucket after this step. ImageKit accesses an object in your bucket only when you request it via its ImageKit URL.

Now head over to the “URL Endpoints” section in the ImageKit dashboard. Your newly added Cloud Storage origin will appear under the Default URL Endpoint. If not, you can always click on Edit URL Endpoint, and add this origin to your ImageKit URL Endpoint.

That's it! The setup is now complete.

We can now start accessing the images in our Cloud Storage bucket via ImageKit. We provided access to the entire storage (using Bucket Folder as /), so we just need to replace the cloud storage URL endpoint with the ImageKit URL endpoint.

https://storage.cloud.google.com/test-imagekit-bucket/product-clothes-3.jpg

The Cloud Storage object URL from our bucket

gets changed to

https://ik.imagekit.io/ikmedia/product-clothes-3.jpg

URL using ImageKit URL endpoint

For an image that is inside a folder in the bucket, we need to retain the folder path in the ImageKit URL as well. For example, if the original image URL is this

https://storage.cloud.google.com/test-imagekit-bucket/watches/product-watch-1.jpg

then its ImageKit URL is

https://ik.imagekit.io/ikmedia/watches/product-watch-1.jpg

Automatic image optimization for Google Cloud Storage

ImageKit automatically determines the formats supported on the requesting device and converts your images to the best format, like WebP or AVIF (if enabled on your account). It also compresses the image using the default quality optimization setting in your ImageKit dashboard.

These automatic optimizations help us serve the right image on every device without worrying about its technicalities.

For example, the original image product-clothes-3.jpg in the storage was 2.5MB in size.

We will optimize this image in Cloud Storage with ImageKit
We will optimize this image in Cloud Storage with ImageKit

When we access it via ImageKit, the image is converted to WebP on a supported browser, and the size comes down to 1.2MB. That's over a 50% reduction in size without making any other change to the URL!

The same 2.5MB image shown above is optimized by ImageKit
The same 2.5MB image shown above is optimized by ImageKit

Real-time image resizing and other transformations for Cloud Storage

With ImageKit, we can also transform our images in real-time by specifying the parameters in the URL.

For example, if we have to resize the above image to width 300px, we just need to add tr=w-300 as a query parameter in our URL.

https://ik.imagekit.io/ikmedia/product-clothes-3.jpg?tr=w-300
Image resized to width 300px
Image resized to width 300px

Need a 300 x 400 image? It should not be a problem with ImageKit's resizing parameters.

https://ik.imagekit.io/ikmedia/product-clothes-3.jpg?tr=w-300,h-400

Like the examples above, ImageKit offers over 50 different transformations, from simple cropping and resizing to more complex ones like watermarking, smart crop, blurring, background change, etc.

These transformations help us deliver responsive images to your users, ensuring excellent performance across devices.

<img srcset="https://ik.imagekit.io/ikmedia/product-clothes-3.jpg?tr=w-300 300w,
	  https://ik.imagekit.io/ikmedia/product-clothes-3.jpg?tr=w-600 600w,
          https://ik.imagekit.io/ikmedia/product-clothes-3.jpg?tr=w-900 900w"
     sizes="(max-width: 480px) 300px, 50vw" />

Example of a responsive image tag

We can also use some of the advanced transformations and go a step further.

Using image and text overlays, we can build rich contextual images and dynamic banners in real-time. Because we can now create a theoretically infinite number of variations in real-time, we can use them for retargeting our users on social media or e-mail.

Here is an example.

In the image below, we have added the company logo and the product's price as text on an image of a shoe using URL parameters to create an image that provides more context to the users. Here, you can check the transformed image URL.

Transformed Image URL - Link
Transformed Image URL - Link

Here is a video demonstrating some of the transformations available in ImageKit.

Examples of real-time image transformations with ImageKit

Improving Lighthouse score for images in Google Cloud Storage

All popular web performance measurement tools, including Lighthouse, PageSpeed, Web Page Test, etc., have items related to image optimization and delivery in their reports. If not resolved, these negatively impact your website's performance and therefore, the SEO and UX on your web page.

With ImageKit, the images in your storage get automatically optimized to the right format, right compression level, and you get the flexibility to resize and transform them to the exact size needed for your UI. The integrated CDN delivers the images in milliseconds to every user across the globe, which helps improve the load time.

These features help you resolve all the image-related issues in web performance reports. A better score, as a result of it, helps you improve your SEO rankings and the user experience you deliver to your customers.

Resize your Images right away!

ImageKit provides a Forever Free plan with 20GB of output bandwidth every month absolutely free.

It can be integrated with your Cloud Storage bucket as shown above and has all the image optimization and transformation features you need to deliver the right images across devices.

Sign up now and start delivering perfectly optimized images on your websites and apps.