<?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[Only PNG images can be added by a script?]]></title><description><![CDATA[<p dir="auto">I’m working on a script that, among other things, sets the image for a glyph. Based on <a href="/topic/25/placing-a-raster-image-for-tracing">this thread</a> with <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/11">@cj</a> and <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/1">@frederik</a>, I’m using the following function:</p>
<pre><code class="language-python">CurrentGlyph().addImage( replacementImageFilePath )
</code></pre>
<p dir="auto">Unfortunately, I receive an error unless the image at that file path is a PNG. The error message is long, but ends with:</p>
<pre><code class="language-console">...
AssertionError: Image does not begin with the PNG signature
</code></pre>
<p dir="auto">I have the same image file in both JPG and PNG formats, but only the PNG will load error-free. I’m surprised to see this, because JPG and TIFF are supported for dragged-in images. Do images loaded by script need to be PNGs?</p>
]]></description><link>https://forum.robofont.com/topic/724/only-png-images-can-be-added-by-a-script</link><generator>RSS for Node</generator><lastBuildDate>Sun, 14 Jun 2026 09:45:01 GMT</lastBuildDate><atom:link href="https://forum.robofont.com/topic/724.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 04 Nov 2019 23:28:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Only PNG images can be added by a script? on Tue, 05 Nov 2019 04:43:41 GMT]]></title><description><![CDATA[<p dir="auto">I’m working on a script that, among other things, sets the image for a glyph. Based on <a href="/topic/25/placing-a-raster-image-for-tracing">this thread</a> with <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/11">@cj</a> and <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/1">@frederik</a>, I’m using the following function:</p>
<pre><code class="language-python">CurrentGlyph().addImage( replacementImageFilePath )
</code></pre>
<p dir="auto">Unfortunately, I receive an error unless the image at that file path is a PNG. The error message is long, but ends with:</p>
<pre><code class="language-console">...
AssertionError: Image does not begin with the PNG signature
</code></pre>
<p dir="auto">I have the same image file in both JPG and PNG formats, but only the PNG will load error-free. I’m surprised to see this, because JPG and TIFF are supported for dragged-in images. Do images loaded by script need to be PNGs?</p>
]]></description><link>https://forum.robofont.com/post/2728</link><guid isPermaLink="true">https://forum.robofont.com/post/2728</guid><dc:creator><![CDATA[nowell]]></dc:creator><pubDate>Tue, 05 Nov 2019 04:43:41 GMT</pubDate></item><item><title><![CDATA[Reply to Only PNG images can be added by a script? on Tue, 05 Nov 2019 11:36:37 GMT]]></title><description><![CDATA[<p dir="auto">yes, PNG only, following the UFO spec</p>
<p dir="auto">see <a href="http://unifiedfontobject.org/versions/ufo3/images/" rel="nofollow">http://unifiedfontobject.org/versions/ufo3/images/</a></p>
<p dir="auto">If you use a drag and drop of any image (png, tiff, jepg) in a glyph window it will be converted internally to a png.</p>
<p dir="auto">If you are using a script to add an image, you have to be sure the image is png or convert it to an png!</p>
<p dir="auto">hope this makes sense and good luck!</p>
]]></description><link>https://forum.robofont.com/post/2729</link><guid isPermaLink="true">https://forum.robofont.com/post/2729</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Tue, 05 Nov 2019 11:36:37 GMT</pubDate></item><item><title><![CDATA[Reply to Only PNG images can be added by a script? on Tue, 05 Nov 2019 13:44:33 GMT]]></title><description><![CDATA[<p dir="auto">hello <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/463">@nowell</a>,</p>
<p dir="auto">here’s a script which can import images in JPEG or TIFF formats:</p>
<pre><code class="language-python">import os
# will move to mojo.tools!
from lib.tools.misc import imagePNGData

imagePath = 'example.jpg'
glyph = CurrentGlyph()
glyph.addImage(data=imagePNGData(imagePath))
</code></pre>
<p dir="auto">the script is using an internal function from the <code>lib</code> to convert the image to PNG – this is usually not advised, because the lib may change and the script will stop working. the function <code>imagePNGData</code> will be moved to <code>mojo.tools</code> in a future release.</p>
]]></description><link>https://forum.robofont.com/post/2730</link><guid isPermaLink="true">https://forum.robofont.com/post/2730</guid><dc:creator><![CDATA[gferreira]]></dc:creator><pubDate>Tue, 05 Nov 2019 13:44:33 GMT</pubDate></item><item><title><![CDATA[Reply to Only PNG images can be added by a script? on Tue, 05 Nov 2019 18:50:51 GMT]]></title><description><![CDATA[<p dir="auto">Thanks, <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/1">@frederik</a> and <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/22">@gferreira</a>! After a good deal of trial and error (this is my first sizable Robofont script), I was able to get this working. Any idea when the PNG converter will move to <code>mojo.tools</code>? Thanks!</p>
]]></description><link>https://forum.robofont.com/post/2732</link><guid isPermaLink="true">https://forum.robofont.com/post/2732</guid><dc:creator><![CDATA[nowell]]></dc:creator><pubDate>Tue, 05 Nov 2019 18:50:51 GMT</pubDate></item><item><title><![CDATA[Reply to Only PNG images can be added by a script? on Tue, 05 Nov 2019 21:14:29 GMT]]></title><description><![CDATA[<p dir="auto">in the upcoming RF3.3!!!</p>
]]></description><link>https://forum.robofont.com/post/2733</link><guid isPermaLink="true">https://forum.robofont.com/post/2733</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Tue, 05 Nov 2019 21:14:29 GMT</pubDate></item><item><title><![CDATA[Reply to Only PNG images can be added by a script? on Mon, 04 Mar 2024 06:10:46 GMT]]></title><description><![CDATA[<p dir="auto">Exploring any script-specific documentation or reaching out to the script's developers might shed more light on this matter.</p>
]]></description><link>https://forum.robofont.com/post/4163</link><guid isPermaLink="true">https://forum.robofont.com/post/4163</guid><dc:creator><![CDATA[Kalisspera]]></dc:creator><pubDate>Mon, 04 Mar 2024 06:10:46 GMT</pubDate></item><item><title><![CDATA[Reply to Only PNG images can be added by a script? on Mon, 04 Mar 2024 06:13:28 GMT]]></title><description><![CDATA[<p dir="auto">BTW, it seems like you're encountering an issue with your script. While PNG files work smoothly with the addImage() function, other formats like JPG might trigger errors due to format compatibility. Although JPG and TIFF are supported for manual dragging, scripts might have specific requirements.</p>
]]></description><link>https://forum.robofont.com/post/4164</link><guid isPermaLink="true">https://forum.robofont.com/post/4164</guid><dc:creator><![CDATA[Kalisspera]]></dc:creator><pubDate>Mon, 04 Mar 2024 06:13:28 GMT</pubDate></item><item><title><![CDATA[Reply to Only PNG images can be added by a script? on Tue, 05 Mar 2024 12:34:00 GMT]]></title><description><![CDATA[<p dir="auto">If you need to work with JPG images, you could consider converting them to PNG format before adding them through the script.</p>
<p dir="auto">And hey, if you ever need to optimize those JPG files for better performance or smaller sizes, check out <a href="https://jpeg-optimizer.com/" rel="nofollow">jpg compress</a> tools. They can help maintain image quality while reducing file sizes effectively.</p>
]]></description><link>https://forum.robofont.com/post/4165</link><guid isPermaLink="true">https://forum.robofont.com/post/4165</guid><dc:creator><![CDATA[Kalisspera]]></dc:creator><pubDate>Tue, 05 Mar 2024 12:34:00 GMT</pubDate></item></channel></rss>