{"id":349055,"date":"2025-10-13T17:31:49","date_gmt":"2025-10-13T22:31:49","guid":{"rendered":"https:\/\/michigandigitalnews.com\/index.php\/2025\/10\/13\/boost-user-engagement-with-ai-image-generation\/"},"modified":"2025-10-13T17:31:49","modified_gmt":"2025-10-13T22:31:49","slug":"boost-user-engagement-with-ai-image-generation","status":"publish","type":"post","link":"https:\/\/michigandigitalnews.com\/index.php\/2025\/10\/13\/boost-user-engagement-with-ai-image-generation\/","title":{"rendered":"Boost user engagement with AI Image Generation"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div style=\"overflow-x: hidden;\">\n<p><img decoding=\"async\" border=\"0\" data-original-height=\"800\" data-original-width=\"100%\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEjq1ibdKVuq7Lmqy44VK9jsCKXpVgePtpfkWYVEg0sOpM8d0xWqNorAmi9_t9TI_IvpqB7cnCL5UQzcK8x5YrWOcx-RYnmTj_Ck6AZbGHJOq0huxI-B8UTuVjiTPhchEDrPoddEhcYb7-ypimuuDnDlrXPIieTpu4KYKbic6dWxd6hk9pi2lgMk6Xzzvpo\/s1600\/Android-Blog-banners.jpg\" style=\"display: block; margin: auto;\"\/><br \/>\n\u00a0\u00a0<br \/>\n<span id=\"docs-internal-guid-44fe28d9-7fff-c5ad-1742-f45417c5b9aa\"><\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">Adding custom images to your app can significantly improve and personalize user experience and boost user engagement. This post explores two new capabilities for image generation with Firebase AI Logic: the specialized Imagen editing features, currently in preview, and the general availability of Gemini 2.5 Flash Image (a.k.a &#8220;Nano Banana&#8221;), designed for contextual or conversational image generation.<\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"><br \/><\/span><br \/>\n\u00a0\u00a0<br \/>\n<span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"\/><br \/>\n\u00a0\u00a0\n<\/p>\n<p dir=\"ltr\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; font-weight: 700; vertical-align: baseline; white-space-collapse: preserve;\">Boost user engagement with images generated via Firebase AI Logic<\/span><\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">Image generation models can be used to create custom user profile avatars or to integrate personalized visual assets directly into key screen flows.<\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"><br \/><\/span><\/p>\n<p>\u00a0\u00a0<\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">For example, Imagen offers new editing features (in developer preview). You can now draw a mask and utilize inpainting to generate pixels within the masked area. Additionally, outpainting is available to generate pixels outside the mask.<\/span><br \/>\n\u00a0\u00a0<\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\">\u00a0<br \/>\n<span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"><br \/><\/span><\/p>\n<p>\u00a0\u00a0<\/p>\n<div class=\"separator\" style=\"clear: both; text-align: center;\"><img decoding=\"async\" border=\"0\" data-original-height=\"392\" data-original-width=\"812\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEjGBa8URoYia_AQG-61mMDoYzlYZ25XP7piafy012cce27HBfF4scuB-tlA3oMzWbro9NMzp6-eX7RNn8uCSmYBfEZueETKJ9hHCed7-mQCsKLd3h2rRlQQU3x3X3RGQUyF5fl9r6i-zvj4l8jbIbPMC7fI530SXOj0IA3x5yd0KqUZgMM_zTxQr1rHilU\/s16000\/Imagen%20inpainting.png\"\/><\/div>\n<p><em face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-style: italic; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"><\/p>\n<p><em face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline;\">Imagen supports inpainting, letting generate only a part of an image.\u00a0<\/em><\/p>\n<p><\/em><\/p>\n<p>\u00a0\u00a0<\/p>\n<p dir=\"ltr\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">Alternatively, Gemini 2.5 Flash Image (a.k.a Nano Banana), can use extended world knowledge and the reasoning capabilities of the Gemini models to generate contextually relevant images, which is ideal for creating dynamic illustrations that align with a user&#8217;s current in-app experience.<\/span>\u00a0 \u00a0<\/p>\n<p dir=\"ltr\">\u00a0\u00a0<\/p>\n<div class=\"separator\" style=\"clear: both; text-align: center;\"><img decoding=\"async\" border=\"0\" data-original-height=\"625\" data-original-width=\"833\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEhKzAelZyshzvZy8uk6RzHQhyGyPdl02OqwYL2cKEFi5BhIvkU6MiVjGDFrQ7_Mzc24lRiwZ7pe_a3ALTc14TbCPhnmv4qSdKdo2rNKR7KJvOQuwsp7zWYiB279l4JbS_4VIBMJqOSSbqI35MCfp5lwBpSdjKDrzuRYvlhjRVJxyv105dI_Ei50hJCqX78\/s16000\/In-context%20nano%20banana%20illustration.png\"\/>\u00a0<em face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">Use Gemini 2.5 Flash Image to create dynamic illustrations contextually relevant to your app.<\/em><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">\u00a0<\/span><\/div>\n<p>\u00a0\u00a0<\/p>\n<p dir=\"ltr\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">Finally, the ability to conversationally and iteratively edit images allow users to edit a photo using natural language.<\/span><\/p>\n<p>\u00a0\u00a0<\/p>\n<div class=\"separator\" style=\"clear: both; text-align: center;\"><img decoding=\"async\" border=\"0\" data-original-height=\"438\" data-original-width=\"860\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEjY-iPTO0OZWbB8Mdi1BrUmC0j-oNiEMu595Wd_6-SVfZjxmCVEJ4mjcL7ARLh34AlLZw6frIE1TErDsFwg8jFqgtAzRjLJrYhX9qVbqyemjigpEAzFvhr-GtTDc9VDWDP0F6X5m2IEiFo01XGGZaNow-MiRcjpGyu3lpeHzj_TByMFDDum0su1HByUm6w\/s16000\/photo%20edit%20natural%20language.png\"\/><\/div>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt; text-align: center;\"><em face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">Use Gemini 2.5 Flash Image to edit a picture using natural language.<\/em><\/p>\n<p>\u00a0\u00a0<\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">When starting to integrate AI to your application, it is important to learn about <\/span><a href=\"https:\/\/cloud.google.com\/vertex-ai\/generative-ai\/docs\/image\/responsible-ai-imagen\" style=\"text-decoration-line: none;\" target=\"_blank\" rel=\"noopener\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space-collapse: preserve;\">AI safety<\/span><\/a><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">. It is particularly key to assess your application&#8217;s security risks, consider adjustments to mitigate safety risks, perform safety testing appropriate to your use case and solicit user feedback and monitor content.<\/span><\/p>\n<p>\u00a0\u00a0<\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; font-weight: 700; vertical-align: baseline; white-space-collapse: preserve;\">Imagen or Gemini: The choice is yours<\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">\u00a0<\/span><\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">The difference between <\/span><a href=\"https:\/\/ai.google.dev\/gemini-api\/docs\/image-generation\" style=\"text-decoration-line: none;\" target=\"_blank\" rel=\"noopener\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space-collapse: preserve;\">Gemini 2.5 Flash Image<\/span><\/a><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"> (&#8220;Nano Banana&#8221;) and <\/span><a href=\"https:\/\/ai.google.dev\/gemini-api\/docs\/imagen\" style=\"text-decoration-line: none;\" target=\"_blank\" rel=\"noopener\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space-collapse: preserve;\">Imagen<\/span><\/a><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"> lies in their primary focus and advanced capabilities. Gemini 2.5 Flash Image, as an image model within the larger Gemini family, excels in conversational image editing, maintaining context and subject consistency across multiple iterations, and leveraging &#8220;world knowledge and reasoning&#8221; to create contextually relevant visuals or embed accurate visuals within long text sequences.\u00a0<\/span><\/p>\n<p>\u00a0\u00a0<\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">Imagen is Google\u2019s specialized image generation model, designed for greater creative control, specializing in highly photorealistic outputs, artistic detail, specific styles, and providing explicit controls for specifying the aspect ratio or format of the generated image.<\/span><\/p>\n<p>\u00a0\u00a0<\/p>\n<div align=\"left\" dir=\"ltr\" style=\"margin-left: 0pt;\">\n<table style=\"border-collapse: collapse; border: none; max-width: 468pt; table-layout: fixed;\">\n<colgroup>\n<col\/>\n<col\/><\/colgroup>\n<tbody>\n<tr style=\"height: 0pt;\">\n<td style=\"border-bottom: solid #000000 1pt; border-color: rgb(0, 0, 0); border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-style: solid; border-top: solid #000000 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;\">\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt; text-align: center;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; font-weight: 700; vertical-align: baseline; white-space-collapse: preserve;\">Gemini 2.5 Flash Images <\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; font-weight: 700; vertical-align: baseline; white-space-collapse: preserve;\"><br \/><\/span><br \/>\n\u00a0\u00a0<br \/>\n<span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; font-weight: 700; vertical-align: baseline; white-space-collapse: preserve;\">(Nano Banana <\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"background-color: white; color: #222222; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; font-weight: 700; vertical-align: baseline; white-space-collapse: preserve;\">\ud83c\udf4c<\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; font-weight: 700; vertical-align: baseline; white-space-collapse: preserve;\">)<\/span><\/p>\n<\/td>\n<td style=\"border-bottom: solid #000000 1pt; border-color: rgb(0, 0, 0); border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-style: solid; border-top: solid #000000 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;\">\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt; text-align: center;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; font-weight: 700; vertical-align: baseline; white-space-collapse: preserve;\">Imagen\u00a0<\/span><\/p>\n<\/td>\n<\/tr>\n<tr style=\"height: 0pt;\">\n<td style=\"border-bottom: solid #000000 1pt; border-color: rgb(0, 0, 0); border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-style: solid; border-top: solid #000000 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;\">\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">\ud83c\udf0e world knowledge and reasoning for more contextually relevant images<\/span><\/p>\n<p>\u00a0\u00a0<\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">\ud83d\udcac edit images conversationally while maintaining context<\/span><\/p>\n<p>\u00a0\u00a0<\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">\ud83d\udcd6 embed accurate visuals within long text sequences<\/span><\/p>\n<\/td>\n<td style=\"border-bottom: solid #000000 1pt; border-color: rgb(0, 0, 0); border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-style: solid; border-top: solid #000000 1pt; border-width: 1pt; overflow-wrap: break-word; overflow: hidden; padding: 5pt; vertical-align: top;\">\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">\ud83d\udcd0 specify the aspect ratio or format of generated images<\/span><\/p>\n<p>\u00a0\u00a0<\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">\ud83d\udd8c\ufe0fSupport of mask-based editing for in-painting and out-painting.\u00a0<\/span><\/p>\n<p>\u00a0\u00a0<\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">\ud83c\udf9a\ufe0f greater control over details of the generated image (quality, artistic detail and specific styles)<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">Let\u2019s see how to use them in your app.<\/span><\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; font-weight: 700; vertical-align: baseline; white-space-collapse: preserve;\">Inpainting with Imagen<\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">\u00a0<\/span><\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">A few months ago, we released new editing features for Imagen. Although Imagen is now ready for production for image generation, editing features are still in <\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-style: italic; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">developer preview<\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">.<\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"\/><\/p>\n<p>\u00a0\u00a0<\/p>\n<p dir=\"ltr\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">Imagen editing features include <\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-style: italic; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">inpainting<\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"> and <\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-style: italic; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">outpainting<\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">, mask-based image editing features. This new capability allows users to modify specific areas of an image without regenerating the entire picture. This means you can preserve the best parts of your image and only alter what you wish to change.<\/span><\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt; text-align: center;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">\u00a0<\/span><\/p>\n<div class=\"separator\" style=\"clear: both; text-align: center;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"><img decoding=\"async\" border=\"0\" data-original-height=\"358\" data-original-width=\"899\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEg8WZrvBzEDtdyJjnVsjjXEE_nKWnWF515ORvkJ4At71BUJJ-hkyUmOiUevKAPZNenftB2mej-bCyXj2MZQgk-tCVRPtVx_QZfVTnfNAjDdGoI_Looms0u7lvBLUAdH3AxcCu2GS_s6FAgriqo3s5sLPjR0-4q1oqHP_ynMgRihwXjtIGUWQ36mn7nABPY\/s16000\/Imagen%20inpainting%20dog.png\"\/><em face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline;\">Use Imagen editing features to make precise targeted changes in an image and guaranteeing the rest of the image integrity<\/em><\/span><\/div>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">These changes are made while maintaining the core elements and overall integrity of the original image and modifying only the area in the mask.<\/span><\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">To implement inpainting with Imagen, first initialize <\/span><span style=\"color: #6aa84f; font-family: &quot;Google Sans Mono&quot;, monospace; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">imagen-3.0-capability-001<\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"> a specific Imagen model supporting editing features:<\/span><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"\/><\/p>\n<p><\/span><\/p>\n<p><!--HTML generated using hilite.me--><\/p>\n<div style=\"background: rgb(255, 255, 255); border: 1pt solid rgb(0, 0, 0); margin: auto; max-width: 468pt; overflow: auto; width: auto;\">\n<pre style=\"line-height: 125%; margin: 0px;\"><span style=\"font-family: courier;\"><span\/><span style=\"color: #888888;\">\/\/ Copyright 2025 Google LLC.<\/span>\n<span style=\"color: #888888;\">\/\/ SPDX-License-Identifier: Apache-2.0<\/span>\n<span style=\"color: #008800; font-weight: bold;\">val<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #996633;\">editingModel<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span>\n<span style=\"color: #bbbbbb;\">        <\/span>Firebase.<span style=\"color: #0000cc;\">ai<\/span>(backend<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>GenerativeBackend.<span style=\"color: #0000cc;\">vertexAI<\/span>()).<span style=\"color: #0000cc;\">imagenModel<\/span>(\n<span style=\"color: #bbbbbb;\">            <\/span><span style=\"background-color: #fff0f0;\">\"imagen-3.0-capability-001\"<\/span>,\n<span style=\"color: #bbbbbb;\">            <\/span>generationConfig<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>ImagenGenerationConfig(\n<span style=\"color: #bbbbbb;\">                <\/span>numberOfImages<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #6600ee; font-weight: bold;\">1<\/span>,\n<span style=\"color: #bbbbbb;\">                <\/span>aspectRatio<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>ImagenAspectRatio.<span style=\"color: #0000cc;\">SQUARE_1x1<\/span>,\n<span style=\"color: #bbbbbb;\">                <\/span>imageFormat<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>ImagenImageFormat.<span style=\"color: #0000cc;\">jpeg<\/span>(compressionQuality<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #6600ee; font-weight: bold;\">75<\/span>),\n<span style=\"color: #bbbbbb;\">            <\/span>),\n<span style=\"color: #bbbbbb;\">        <\/span>)\n<\/span><\/pre>\n<\/div>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">From there, define the inpainting function:<\/span><\/p>\n<p><!--HTML generated using hilite.me--><\/p>\n<div style=\"background: rgb(255, 255, 255); border: 1pt solid rgb(0, 0, 0); margin: auto; max-width: 468pt; overflow: auto; width: auto;\">\n<pre style=\"line-height: 125%; margin: 0px; text-align: left;\"><span style=\"font-family: courier;\"><span\/><span style=\"color: #888888;\">\/\/ Copyright 2025 Google LLC.<\/span>\n<span style=\"color: #888888;\">\/\/ SPDX-License-Identifier: Apache-2.0<\/span>\n\n<span style=\"color: #008800; font-weight: bold;\">val<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #996633;\">prompt<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"background-color: #fff0f0;\">\"remove the pancakes and make it an omelet instead\"<\/span>\n\n<span style=\"color: #008800; font-weight: bold;\">suspend<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #008800; font-weight: bold;\">fun<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #0066bb; font-weight: bold;\">inpaintImageWithMask<\/span>(sourceImage:<span style=\"color: #bbbbbb;\"> <\/span>Bitmap,<span style=\"color: #bbbbbb;\"> <\/span>maskImage:<span style=\"color: #bbbbbb;\"> <\/span>Bitmap,<span style=\"color: #bbbbbb;\"> <\/span>prompt:<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333399; font-weight: bold;\">String<\/span>,<span style=\"color: #bbbbbb;\"> <\/span>editSteps:<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333399; font-weight: bold;\">Int<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #6600ee; font-weight: bold;\">50<\/span>):<span style=\"color: #bbbbbb;\"> <\/span>Bitmap<span style=\"color: #bbbbbb;\"> <\/span>{\n<span style=\"color: #bbbbbb;\">        <\/span><span style=\"color: #008800; font-weight: bold;\">val<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #996633;\">imageResponse<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>editingModel.<span style=\"color: #0000cc;\">editImage<\/span>(\n<span style=\"color: #bbbbbb;\">            <\/span>referenceImages<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>listOf(\n<span style=\"color: #bbbbbb;\">                <\/span>ImagenRawImage(sourceImage.<span style=\"color: #0000cc;\">toImagenInlineImage<\/span>()),\n<span style=\"color: #bbbbbb;\">                <\/span>ImagenRawMask(maskImage.<span style=\"color: #0000cc;\">toImagenInlineImage<\/span>()),\n<span style=\"color: #bbbbbb;\">            <\/span>),\n<span style=\"color: #bbbbbb;\">            <\/span>prompt<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>prompt,\n<span style=\"color: #bbbbbb;\">            <\/span>config<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>ImagenEditingConfig(\n<span style=\"color: #bbbbbb;\">                <\/span>editMode<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>ImagenEditMode.<span style=\"color: #0000cc;\">INPAINT_INSERTION<\/span>,\n<span style=\"color: #bbbbbb;\">                <\/span>editSteps<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>editSteps,\n<span style=\"color: #bbbbbb;\">            <\/span>),\n<span style=\"color: #bbbbbb;\">        <\/span>)\n<span style=\"color: #bbbbbb;\">        <\/span><span style=\"color: #008800; font-weight: bold;\">return<\/span><span style=\"color: #bbbbbb;\"> <\/span>imageResponse.<span style=\"color: #0000cc;\">images<\/span>.<span style=\"color: #0000cc;\">first<\/span>().<span style=\"color: #0000cc;\">asBitmap<\/span>()\n<span style=\"color: #bbbbbb;\">    <\/span>}<\/span><\/pre>\n<\/div>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">You provide both a <\/span><span face=\"Consolas, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">sourceImage<\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">, a <\/span><span face=\"Consolas, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">maskImage<\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"> and a <\/span><span face=\"Consolas, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">prompt<\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"> for the edit and the number of edit steps to be performed.<\/span><\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">You can see it in action in the <\/span><a href=\"https:\/\/github.com\/android\/ai-samples\/tree\/main\/ai-catalog\/samples\/imagen-editing\" style=\"text-decoration-line: none;\" target=\"_blank\" rel=\"noopener\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space-collapse: preserve;\">Imagen Editing Sample<\/span><\/a><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"> in the Android AI Sample catalog!<\/span><\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">And Imagen also supports <\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-style: italic; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">outpainting<\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"> that enables you to let the model generate the pixels outside of a mask. You can also use Imagen\u2019s Image customization capabilities to change the style of a picture or update a subject in a picture. Read more about it in the <\/span><a href=\"https:\/\/developer.android.com\/ai\/imagen#editing\" style=\"text-decoration-line: none;\" target=\"_blank\" rel=\"noopener\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space-collapse: preserve;\">Android developer documentation<\/span><\/a><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">.<\/span><\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; font-weight: 700; vertical-align: baseline; white-space-collapse: preserve;\">Conversational image generation with Gemini 2.5 Flash Image<\/span><\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">One way to edit images with Gemini 2.5 Flash Image is to use the model\u2019s multi-turn chat capabilities.<\/span><\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">First, initialize the model:<\/span><\/p>\n<p><\/p>\n<p><!--HTML generated using hilite.me--><\/p>\n<div style=\"background: rgb(255, 255, 255); border: 1pt solid rgb(0, 0, 0); margin: auto; max-width: 468pt; overflow: auto; width: auto;\">\n<pre style=\"line-height: 125%; margin: 0px;\"><span style=\"font-family: courier;\"><span\/><span style=\"color: #888888;\">\/\/ Copyright 2025 Google LLC.<\/span>\n<span style=\"color: #888888;\">\/\/ SPDX-License-Identifier: Apache-2.0<\/span>\n\n<span style=\"color: #008800; font-weight: bold;\">val<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #996633;\">model<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>Firebase.<span style=\"color: #0000cc;\">ai<\/span>(backend<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>GenerativeBackend.<span style=\"color: #0000cc;\">googleAI<\/span>()).<span style=\"color: #0000cc;\">generativeModel<\/span>(\n<span style=\"color: #bbbbbb;\">    <\/span>modelName<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"background-color: #fff0f0;\">\"gemini-2.5-flash-image\"<\/span>,\n<span style=\"color: #bbbbbb;\">    <\/span><span style=\"color: #888888;\">\/\/ Configure the model to respond with text and images (required)<\/span>\n<span style=\"color: #bbbbbb;\">    <\/span>generationConfig<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>generationConfig<span style=\"color: #bbbbbb;\"> <\/span>{\n<span style=\"color: #bbbbbb;\">        <\/span>responseModalities<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>listOf(ResponseModality.<span style=\"color: #0000cc;\">TEXT<\/span>,\n<span style=\"color: #bbbbbb;\">        <\/span>ResponseModality.<span style=\"color: #0000cc;\">IMAGE<\/span>)\n<span style=\"color: #bbbbbb;\">    <\/span>}\n)<\/span>\n<\/pre>\n<\/div>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">To achieve a similar outcome to the mask-based Imagen method described above, we can utilize the <\/span><span style=\"color: #188038; font-family: &quot;Roboto Mono&quot;, monospace; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">chat<\/span><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"> API to initiate a conversation with Gemini 2.5 Flash Image.<\/span><\/p>\n<p><\/p>\n<p><!--HTML generated using hilite.me--><\/p>\n<div style=\"background: rgb(255, 255, 255); border: 1pt solid rgb(0, 0, 0); margin: auto; max-width: 468pt; overflow: auto; width: auto;\">\n<pre style=\"line-height: 125%; margin: 0px;\"><span style=\"font-family: courier;\"><span\/><span style=\"color: #888888;\">\/\/ Copyright 2025 Google LLC.<\/span>\n<span style=\"color: #888888;\">\/\/ SPDX-License-Identifier: Apache-2.0<\/span>\n\n<span style=\"color: #888888;\">\/\/ Initialize the chat<\/span>\n<span style=\"color: #008800; font-weight: bold;\">val<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #996633;\">chat<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>model.<span style=\"color: #0000cc;\">startChat<\/span>()\n\n\n<span style=\"color: #888888;\">\/\/ Load a bitmap<\/span>\n<span style=\"color: #008800; font-weight: bold;\">val<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #996633;\">source<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>ImageDecoder.<span style=\"color: #0000cc;\">createSource<\/span>(context.<span style=\"color: #0000cc;\">contentResolver<\/span>,<span style=\"color: #bbbbbb;\"> <\/span>uri)\n<span style=\"color: #008800; font-weight: bold;\">val<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #996633;\">bitmap<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>ImageDecoder.<span style=\"color: #0000cc;\">decodeBitmap<\/span>(source)\n\n\n<span style=\"color: #888888;\">\/\/ Create the initial prompt instructing the model to edit the image<\/span>\n<span style=\"color: #008800; font-weight: bold;\">val<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #996633;\">prompt<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>content<span style=\"color: #bbbbbb;\"> <\/span>{\n<span style=\"color: #bbbbbb;\">    <\/span>image(bitmap)\n<span style=\"color: #bbbbbb;\">    <\/span>text(<span style=\"background-color: #fff0f0;\">\"remove the pancakes and add an omelet\"<\/span>)\n}\n\n<span style=\"color: #888888;\">\/\/ To generate an initial response, send a user message with the image and text prompt<\/span>\n<span style=\"color: #008800; font-weight: bold;\">var<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #996633;\">response<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>chat.<span style=\"color: #0000cc;\">sendMessage<\/span>(prompt)\n\n<span style=\"color: #888888;\">\/\/ Inspect the returned image<\/span>\n<span style=\"color: #008800; font-weight: bold;\">var<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #996633;\">generatedImageAsBitmap<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>response\n<span style=\"color: #bbbbbb;\">    <\/span>.<span style=\"color: #0000cc;\">candidates<\/span>.<span style=\"color: #0000cc;\">first<\/span>().<span style=\"color: #0000cc;\">content<\/span>.<span style=\"color: #0000cc;\">parts<\/span>.<span style=\"color: #0000cc;\">filterIsInstance<\/span><span style=\"color: #333333;\">&lt;<\/span>ImagePart<span style=\"color: #333333;\">&gt;<\/span>().<span style=\"color: #0000cc;\">firstOrNull<\/span>()<span style=\"color: #333333;\">?.<\/span><span style=\"color: #0000cc;\">image<\/span>\n\n<span style=\"color: #888888;\">\/\/ Follow up requests do not need to specify the image again<\/span>\nresponse<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>chat.<span style=\"color: #0000cc;\">sendMessage<\/span>(<span style=\"background-color: #fff0f0;\">\"Now, center the omelet in the pan\"<\/span>)\ngeneratedImageAsBitmap<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>response\n<span style=\"color: #bbbbbb;\">    <\/span>.<span style=\"color: #0000cc;\">candidates<\/span>.<span style=\"color: #0000cc;\">first<\/span>().<span style=\"color: #0000cc;\">content<\/span>.<span style=\"color: #0000cc;\">parts<\/span>.<span style=\"color: #0000cc;\">filterIsInstance<\/span><span style=\"color: #333333;\">&lt;<\/span>ImagePart<span style=\"color: #333333;\">&gt;<\/span>().<span style=\"color: #0000cc;\">firstOrNull<\/span>()<span style=\"color: #333333;\">?.<\/span><span style=\"color: #0000cc;\">image<\/span><\/span>\n<\/pre>\n<\/div>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">You can see it in action in the <\/span><a href=\"https:\/\/github.com\/android\/ai-samples\/tree\/main\/ai-catalog\/samples\/gemini-image-chat\" style=\"text-decoration-line: none;\" target=\"_blank\" rel=\"noopener\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space-collapse: preserve;\">Gemini Image Chat sample<\/span><\/a><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"> in the Android AI Sample catalog and read more about it in the <\/span><a href=\"https:\/\/developer.android.com\/ai\/gemini\/developer-api#generate-images\" style=\"text-decoration-line: none;\" target=\"_blank\" rel=\"noopener\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space-collapse: preserve;\">Android documentation<\/span><\/a><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">.<\/span><\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; font-weight: 700; vertical-align: baseline; white-space-collapse: preserve;\">Conclusion<\/span><\/p>\n<p dir=\"ltr\" style=\"margin-bottom: 0pt; margin-top: 0pt;\"><span face=\"&quot;Google Sans&quot;, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">Both Imagen and Gemini 2.5 Flash Image offer powerful capabilities, allowing you to select the ideal image generation model to personalize your app and boost user engagement, depending on your specific use case.<\/span><\/p>\n<\/div>\n<p>[ad_2]<br \/>\n<br \/><a href=\"http:\/\/android-developers.googleblog.com\/2025\/10\/boost-user-engagement-with-ai-image.html\">Source link <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] \u00a0\u00a0 Adding custom images to your app can significantly improve and personalize user experience and boost user engagement. This post explores two new capabilities<\/p>\n","protected":false},"author":1,"featured_media":349056,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[146],"tags":[],"_links":{"self":[{"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/posts\/349055"}],"collection":[{"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/comments?post=349055"}],"version-history":[{"count":0,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/posts\/349055\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/media\/349056"}],"wp:attachment":[{"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/media?parent=349055"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/categories?post=349055"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/tags?post=349055"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}