<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>idea Improved support for arcgis.apps.storymap module: Block.add_content() - &amp;quot;fit&amp;quot; parameter in ArcGIS API for Python Ideas</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-ideas/improved-support-for-arcgis-apps-storymap-module/idi-p/1627975</link>
    <description>&lt;P&gt;Adding an image to a StoryMap Briefing using the GUI automatically fits the image to the size of the Block. After adding the Image, I can inspect the items JSON with the following code:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.apps.storymap.briefing import Briefing
briefing = Briefing('&amp;lt;my_briefing_id&amp;gt;')
briefingItem = smBriefing.save()
briefJson = briefingItem.get_data(try_json=True)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I inspect the node for the Image that I added via GUI in briefJson, the 'config' property is as follows:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;"config": {
  "placement": {
    "type": "fit",
    "fill": {
      "x": 0.5,
      "y": 0.5
    },
    "fit": {
      "color": "backgroundColor"
    }
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When adding an image to the StoryMap Briefing via the Python API, the&amp;nbsp;&lt;SPAN&gt;arcgis.apps.storymap.story_content.Block.add_content() method does not offer a "fit" parameter, and the image is added to the Block at it's default size. When adding an image to a block via Python API, the config property in the image node is:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;"config": {
  {
    "size":''
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It is cumbersome to resize images based on the block size, especially when the block size isn't immediately clear.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My idea is to add more flexibility to adding media content to blocks by offering a "fit" parameter.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;EDIT: Upon looking into the API documentation further, I realized that I'd missed the Image.display property. Unfortunately, the size of the image that I added via API does not change, no matter what display value I set.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.apps.storymap.briefing import Briefing
from arcgis.apps.storymap.story_content import Image, SlideLayout

myImage = Image(imagePath)
slide = briefing.add(layout=SlideLayout.SINGLE, title='Slide Title')
contentBlock = slide.blocks[0] #only 1 content block in SINGLE layout slides
contentBlock.add_content(myImage)
imageContent = contentBlock.content[0]

# Edit image after adding it to the briefing per API standard:
# "Once you create an Image instance you must add it to the story to be able to edit it further."

imageContent.display='small' #or 'float', 'wide', 'full' -&amp;gt; it doesn't matter, the size of the image in the output briefing slide doesen't change.
brief.save()&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;After saving the Brief, I am able to change the size of the image to fit in the content block via GUI by clicking image options, and selecting the radio button for Fit (do not crop). Unfortunately, I still can't find a way to do this via API.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Jun 2025 21:24:30 GMT</pubDate>
    <dc:creator>ATFerguson</dc:creator>
    <dc:date>2025-06-27T21:24:30Z</dc:date>
    <item>
      <title>Improved support for arcgis.apps.storymap module: Block.add_content() - "fit" parameter</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-ideas/improved-support-for-arcgis-apps-storymap-module/idi-p/1627975</link>
      <description>&lt;P&gt;Adding an image to a StoryMap Briefing using the GUI automatically fits the image to the size of the Block. After adding the Image, I can inspect the items JSON with the following code:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.apps.storymap.briefing import Briefing
briefing = Briefing('&amp;lt;my_briefing_id&amp;gt;')
briefingItem = smBriefing.save()
briefJson = briefingItem.get_data(try_json=True)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I inspect the node for the Image that I added via GUI in briefJson, the 'config' property is as follows:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;"config": {
  "placement": {
    "type": "fit",
    "fill": {
      "x": 0.5,
      "y": 0.5
    },
    "fit": {
      "color": "backgroundColor"
    }
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When adding an image to the StoryMap Briefing via the Python API, the&amp;nbsp;&lt;SPAN&gt;arcgis.apps.storymap.story_content.Block.add_content() method does not offer a "fit" parameter, and the image is added to the Block at it's default size. When adding an image to a block via Python API, the config property in the image node is:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;"config": {
  {
    "size":''
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It is cumbersome to resize images based on the block size, especially when the block size isn't immediately clear.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My idea is to add more flexibility to adding media content to blocks by offering a "fit" parameter.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;EDIT: Upon looking into the API documentation further, I realized that I'd missed the Image.display property. Unfortunately, the size of the image that I added via API does not change, no matter what display value I set.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.apps.storymap.briefing import Briefing
from arcgis.apps.storymap.story_content import Image, SlideLayout

myImage = Image(imagePath)
slide = briefing.add(layout=SlideLayout.SINGLE, title='Slide Title')
contentBlock = slide.blocks[0] #only 1 content block in SINGLE layout slides
contentBlock.add_content(myImage)
imageContent = contentBlock.content[0]

# Edit image after adding it to the briefing per API standard:
# "Once you create an Image instance you must add it to the story to be able to edit it further."

imageContent.display='small' #or 'float', 'wide', 'full' -&amp;gt; it doesn't matter, the size of the image in the output briefing slide doesen't change.
brief.save()&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;After saving the Brief, I am able to change the size of the image to fit in the content block via GUI by clicking image options, and selecting the radio button for Fit (do not crop). Unfortunately, I still can't find a way to do this via API.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jun 2025 21:24:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-ideas/improved-support-for-arcgis-apps-storymap-module/idi-p/1627975</guid>
      <dc:creator>ATFerguson</dc:creator>
      <dc:date>2025-06-27T21:24:30Z</dc:date>
    </item>
  </channel>
</rss>

