<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Image Widgets]]></title><description><![CDATA[<h2><a class="anchor-offset" name="introduction"></a>Introduction</h2>
<p dir="auto">There are quite a few ways for you to add images to your project. You can either add an image widget directly onto the stage, or attach an image to another widget. The source of the image can be a costume or the URL of an image shared online.</p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="add-image-from-costume"></a>Add Image from Costume</h2>
<p dir="auto">To add any costume image to the stage as a widget by itself, you can use the following block:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/b41cc29c-4553-40de-9ef6-66473ab3b069.png" alt="088fa25d-0a47-4052-8d9f-d86f5cecbe01-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"> </p>
<ul>
<li><strong>Costume Selection</strong>: The first input lists all the costumes in this sprite for you to choose from</li>
<li><strong>X and Y</strong>: The position of the center point of the image widget. To place the image at the center of the stage, you can set both X and Y to 0.</li>
<li><strong>Width and Height</strong>: The size of the image widget.</li>
<li><strong>Aspect Ratio Type</strong>: The image from the costume will be scaled up or down to fit into the given width and height. But you can control its aspect ratio (ratio between width and height). If “keep” is selected, the image will keep its aspect ratio, so the image will look normal, but the image may not fully occupy the rectangle area. If “stretch” is selected, the image will occupy the entire rectangle area, but it may be stretched horizontally or vertically.</li>
<li><strong>Name</strong>: The last input is the name of the image widget.</li>
</ul>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="example"></a>Example</h2>
<p dir="auto">This example shows the difference between the 2 aspect ratio types using 2 costume images. The image widget is a square shape that is 300 by 300, but the 2 costume images are not square, so we see a difference between ‘keep’ and ‘stretch’ options:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/c9c3811e-bb57-4c77-acb0-1216446e87fb.gif" alt="d5.gif" class=" img-fluid img-markdown" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="update-image-widget-background"></a>Update Image Widget Background</h2>
<p dir="auto">You can still update the background of the image if it has transparent areas:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/c4a30c49-e250-4ff1-92b3-0d19f0e83c3b.png" alt="4aa2aa73-b383-4710-b91a-c1654a05126a-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"> <br />
<img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/f7ff20c4-dbff-4b06-9eba-ac14a821a65f.png" alt="75b1f384-5fae-490e-9b9e-2b683bafb88d-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="image-from-url"></a>Image from URL</h2>
<p dir="auto">If you have the URL of an image online, you can add it directly using the following block:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/6c7e8488-66bf-475e-b5c0-684d4595a7fd.png" alt="ae3c8d6f-80c0-4b70-8384-e38839213e29-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"> <br />
The first input has to be the URL of an image, such as ,.</p>
<p dir="auto">All the other inputs are the same as the previous block.</p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="attaching-a-costume-image-to-a-widget"></a>Attaching a Costume Image to A Widget</h2>
<p dir="auto">Sometimes we may need to attach one or multiple images to another widget, such as a label or a button. You can use the “add image to widget” block:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/54cd10ae-9066-4fea-aa44-be3be701fb9a.png" alt="62cfef46-54d3-444f-81c0-7ed0c585d865-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"> </p>
<ul>
<li><strong>Costume</strong>: The first input is the costume to use</li>
<li><strong>Parent Widget</strong>: The second input is an existing widget, such as a label or button, that will be used as the parent of the image we are adding.</li>
<li><strong>X and Y</strong>: These are the position of the image <strong>relative to</strong> the parent widget. For example, if X=0 and Y=0, the image will be added at the center of the parent widget.</li>
</ul>
<p dir="auto"> <br />
Note that you can not set the width and height of the widget. It will be scaled to fit the height of the parent widget.</p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="example"></a>Example</h2>
<p dir="auto">In this example, we add a label first, then set its text style to make sure the text “Coddy” appears on the left. Then we attach the costume image to the right side of the label.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/db9adcc9-5829-4ed1-b321-59f2eeb9081d.png" alt="98e37f1c-82fc-4325-a5ed-14f97f6fb52b-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"> <br />
This is what we get:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/3777de78-fce3-41bc-b933-a984e5c23335.png" alt="6eb7ec43-2e71-4eed-b8d6-7e38abcccf2d-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="attach-an-online-image-using-its-url"></a>Attach An Online Image Using Its URL</h2>
<p dir="auto">You can also attach an online image to a parent widget like this:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/83a34977-6cce-441e-8161-2f4adf38c0d4.png" alt="4ece48b9-5d85-427d-be62-9508a59fc28e-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"> <br />
This is what you get:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/76d1154c-2d71-40da-bb80-ae66811f2531.png" alt="de48dd99-ef2b-4c04-b3d8-227d3864834f-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.creaticode.com/topic/954/image-widgets</link><generator>RSS for Node</generator><lastBuildDate>Tue, 17 Nov 2026 01:46:07 GMT</lastBuildDate><atom:link href="https://forum.creaticode.com/topic/954.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 06 May 2023 10:40:02 GMT</pubDate><ttl>60</ttl></channel></rss>