<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[Gimp-Forum.net - Tutorials and tips]]></title>
		<link>https://www.gimp-forum.net/</link>
		<description><![CDATA[Gimp-Forum.net - https://www.gimp-forum.net]]></description>
		<pubDate>Sat, 02 May 2026 06:01:09 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Batcher and simple animation.]]></title>
			<link>https://www.gimp-forum.net/Thread-Batcher-and-simple-animation</link>
			<pubDate>Sat, 18 Apr 2026 11:31:34 +0000</pubDate>
			<guid isPermaLink="false">https://www.gimp-forum.net/Thread-Batcher-and-simple-animation</guid>
			<description><![CDATA[Looks like nobody is using Gimp anymore, it is all AI, however Gimp 3 can come in useful at times.<br />
<br />
This is using the Gimp 3 plugin Batcher   <a href="https://kamilburda.github.io/batcher/" target="_blank">https://kamilburda.github.io/batcher/</a><br />
<br />
(1) Removing a plain color background from an animation.  It might be something downloaded from one of those animation websites.  If it is possible using Color -&gt; Color-to-Alpha then in Batcher these Gimp operations gimp-layer-add-alpha and color-to-alpha<br />
<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=14372" target="_blank" title="">batcher-ani-01.jpg</a> (Size: 87.94 KB / Downloads: 41)
<!-- end: postbit_attachments_attachment --><br />
<br />
<br />
<!-- start: video_youtube_embed --><br />
<iframe width="560" height="315" src="//www.youtube.com/embed/nj93PI351WY" frameborder="0" allowfullscreen></iframe><br />
<!-- end: video_youtube_embed --><br />
<br />
(2) Distributing the layers across the canvas using the Gimp 3 Align tool and adding a background with Batcher.<br />
<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=14373" target="_blank" title="">batcher-ani-02.jpg</a> (Size: 100.9 KB / Downloads: 37)
<!-- end: postbit_attachments_attachment --><br />
<br />
<br />
<!-- start: video_youtube_embed --><br />
<iframe width="560" height="315" src="//www.youtube.com/embed/P3a9qK4i1Ps" frameborder="0" allowfullscreen></iframe><br />
<!-- end: video_youtube_embed --><br />
<br />
Which gives this:<br />
<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="GIF Image" border="0" alt=".gif" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=14374" target="_blank" title="">walking.gif</a> (Size: 289.13 KB / Downloads: 215)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[Looks like nobody is using Gimp anymore, it is all AI, however Gimp 3 can come in useful at times.<br />
<br />
This is using the Gimp 3 plugin Batcher   <a href="https://kamilburda.github.io/batcher/" target="_blank">https://kamilburda.github.io/batcher/</a><br />
<br />
(1) Removing a plain color background from an animation.  It might be something downloaded from one of those animation websites.  If it is possible using Color -&gt; Color-to-Alpha then in Batcher these Gimp operations gimp-layer-add-alpha and color-to-alpha<br />
<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=14372" target="_blank" title="">batcher-ani-01.jpg</a> (Size: 87.94 KB / Downloads: 41)
<!-- end: postbit_attachments_attachment --><br />
<br />
<br />
<!-- start: video_youtube_embed --><br />
<iframe width="560" height="315" src="//www.youtube.com/embed/nj93PI351WY" frameborder="0" allowfullscreen></iframe><br />
<!-- end: video_youtube_embed --><br />
<br />
(2) Distributing the layers across the canvas using the Gimp 3 Align tool and adding a background with Batcher.<br />
<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=14373" target="_blank" title="">batcher-ani-02.jpg</a> (Size: 100.9 KB / Downloads: 37)
<!-- end: postbit_attachments_attachment --><br />
<br />
<br />
<!-- start: video_youtube_embed --><br />
<iframe width="560" height="315" src="//www.youtube.com/embed/P3a9qK4i1Ps" frameborder="0" allowfullscreen></iframe><br />
<!-- end: video_youtube_embed --><br />
<br />
Which gives this:<br />
<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="GIF Image" border="0" alt=".gif" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=14374" target="_blank" title="">walking.gif</a> (Size: 289.13 KB / Downloads: 215)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Tool Presets]]></title>
			<link>https://www.gimp-forum.net/Thread-Tool-Presets</link>
			<pubDate>Sun, 05 Apr 2026 13:30:47 +0000</pubDate>
			<guid isPermaLink="false">https://www.gimp-forum.net/Thread-Tool-Presets</guid>
			<description><![CDATA[Most of the tools have presets that you can save. I only found out this today! You can save a desired preset's name  for most tools that have a tool option etc and also edit it here. These show in the 'blue bucket icon with tools' for the different tools. If you click on the tool icon you can see all the different tool presets etc come up.<br /><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=14345" target="_blank" title="">Text preset blue bucket.png</a> (Size: 41.6 KB / Downloads: 47)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[Most of the tools have presets that you can save. I only found out this today! You can save a desired preset's name  for most tools that have a tool option etc and also edit it here. These show in the 'blue bucket icon with tools' for the different tools. If you click on the tool icon you can see all the different tool presets etc come up.<br /><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=14345" target="_blank" title="">Text preset blue bucket.png</a> (Size: 41.6 KB / Downloads: 47)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Setting a default directory to save files]]></title>
			<link>https://www.gimp-forum.net/Thread-Setting-a-default-directory-to-save-files</link>
			<pubDate>Sun, 07 Dec 2025 17:30:06 +0000</pubDate>
			<guid isPermaLink="false">https://www.gimp-forum.net/Thread-Setting-a-default-directory-to-save-files</guid>
			<description><![CDATA[You will have noticed that Gimp is hell-bent into saving everything by default in your <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Documents</span> folder. It's no completely Gimp faults, it is the behavior of the GTK file dialog thayt Gimp uses. <br />
<br />
The simple but incomplete solution is to add your favorite folder(s) to the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Bookmarks</span> panel on the left.<br />
<br />
But you can also make Gimp use any directory by making it think it is your <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Documents</span> folder. <br />
<ul>
<li>The FreeDesktop standard defines several directories:  DESKTOP, DOWNLOAD, TEMPLATES, PUBLICSHARE, DOCUMENTS, MUSIC, PICTURES, VIDEOS<br />
</li>
<li>A configuration file called <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">user-dirs.dirs</span> can be used to define what actual directory is used for these symbolic directories. This is typically used to give language-dependent names. <br />
</li>
<li><span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">user-dirs.dirs</span> is normally in <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">~/.config</span> but you can tell the desktop code to use a different one by setting <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">XDG_CONFIG_HOME</span> environment variable to a directory that contains another version of <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">user-dirs.dirs</span> <br />
</li>
<li>You update the file with the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">xdg-user-dirs-update</span> command, and you can check it use the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">xdg-user-dir</span> command. These two commands will of course check the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">XDG_CONFIG_HOME</span> environment variable.<br />
</li></ul>
So, all that is needed is to prepare a <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">user-dirs.dirs</span> pointing to the required directory, and set the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">XDG_CONFIG_HOME</span> environment variable to point  to the alternate <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">user-dirs.dirs</span> directory in a script before calling Gimp.<br />
<br />
So for instance, setting your destination directory to <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">~/tmp</span>:<br />
<br />
Do once:<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>export XDG_CONFIG_HOME=~/tmp/               # directory for user-dirs file, and your Gimp files<br />
xdg-user-dirs-update --set DOCUMENTS ~/tmp  # Creates/updates the user-dirs file</code></div></div>
<br />
<br />
Before calling Gimp (so create/modify script):<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>export XDG_CONFIG_HOME=~/tmp/  # tell FreeDesktop where to look for directories definition<br />
gimp                           # start Gimp (can also be "exec gimp" to get rid of one level of shell)</code></div></div>
<br />
The exemple above keeps the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">user-dirs.dir</span> file and the Gimp files in the same directory but using different directories is left as an exercise for the reader.<br />
<br />
If any Windows or OSX users are reading this, I wonder if this applies in other OS as well. If you are missing the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">xdg-user-dirs-update</span> command, <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">user-dirs.dirs</span> is a plain text file and it looks like this:<br />
<br />
<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);"></span><span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);"><br />
# This file is written by xdg-user-dirs-update<br />
# If you want to change or add directories, just edit the line you're<br />
# interested in. All local changes will be retained on the next run.<br />
# Format is XDG_xxx_DIR="&#36;HOME/yyy", where yyy is a shell-escaped<br />
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an<br />
# absolute path. No other format is supported.<br />
# <br />
XDG_DOCUMENTS_DIR="&#36;HOME/tmp"<br />
</span><span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);"></span>]]></description>
			<content:encoded><![CDATA[You will have noticed that Gimp is hell-bent into saving everything by default in your <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Documents</span> folder. It's no completely Gimp faults, it is the behavior of the GTK file dialog thayt Gimp uses. <br />
<br />
The simple but incomplete solution is to add your favorite folder(s) to the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Bookmarks</span> panel on the left.<br />
<br />
But you can also make Gimp use any directory by making it think it is your <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Documents</span> folder. <br />
<ul>
<li>The FreeDesktop standard defines several directories:  DESKTOP, DOWNLOAD, TEMPLATES, PUBLICSHARE, DOCUMENTS, MUSIC, PICTURES, VIDEOS<br />
</li>
<li>A configuration file called <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">user-dirs.dirs</span> can be used to define what actual directory is used for these symbolic directories. This is typically used to give language-dependent names. <br />
</li>
<li><span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">user-dirs.dirs</span> is normally in <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">~/.config</span> but you can tell the desktop code to use a different one by setting <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">XDG_CONFIG_HOME</span> environment variable to a directory that contains another version of <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">user-dirs.dirs</span> <br />
</li>
<li>You update the file with the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">xdg-user-dirs-update</span> command, and you can check it use the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">xdg-user-dir</span> command. These two commands will of course check the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">XDG_CONFIG_HOME</span> environment variable.<br />
</li></ul>
So, all that is needed is to prepare a <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">user-dirs.dirs</span> pointing to the required directory, and set the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">XDG_CONFIG_HOME</span> environment variable to point  to the alternate <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">user-dirs.dirs</span> directory in a script before calling Gimp.<br />
<br />
So for instance, setting your destination directory to <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">~/tmp</span>:<br />
<br />
Do once:<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>export XDG_CONFIG_HOME=~/tmp/               # directory for user-dirs file, and your Gimp files<br />
xdg-user-dirs-update --set DOCUMENTS ~/tmp  # Creates/updates the user-dirs file</code></div></div>
<br />
<br />
Before calling Gimp (so create/modify script):<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>export XDG_CONFIG_HOME=~/tmp/  # tell FreeDesktop where to look for directories definition<br />
gimp                           # start Gimp (can also be "exec gimp" to get rid of one level of shell)</code></div></div>
<br />
The exemple above keeps the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">user-dirs.dir</span> file and the Gimp files in the same directory but using different directories is left as an exercise for the reader.<br />
<br />
If any Windows or OSX users are reading this, I wonder if this applies in other OS as well. If you are missing the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">xdg-user-dirs-update</span> command, <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">user-dirs.dirs</span> is a plain text file and it looks like this:<br />
<br />
<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);"></span><span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);"><br />
# This file is written by xdg-user-dirs-update<br />
# If you want to change or add directories, just edit the line you're<br />
# interested in. All local changes will be retained on the next run.<br />
# Format is XDG_xxx_DIR="&#36;HOME/yyy", where yyy is a shell-escaped<br />
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an<br />
# absolute path. No other format is supported.<br />
# <br />
XDG_DOCUMENTS_DIR="&#36;HOME/tmp"<br />
</span><span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);"></span>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Astrophotography - Creating masks]]></title>
			<link>https://www.gimp-forum.net/Thread-Astrophotography-Creating-masks</link>
			<pubDate>Fri, 17 Oct 2025 20:18:55 +0000</pubDate>
			<guid isPermaLink="false">https://www.gimp-forum.net/Thread-Astrophotography-Creating-masks</guid>
			<description><![CDATA[Can anyone guide me to a video, link or post that explains how to edit and create mask for astrophotography images?]]></description>
			<content:encoded><![CDATA[Can anyone guide me to a video, link or post that explains how to edit and create mask for astrophotography images?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Windows Gimp 3.0 symbol entry]]></title>
			<link>https://www.gimp-forum.net/Thread-Windows-Gimp-3-0-symbol-entry</link>
			<pubDate>Mon, 09 Jun 2025 08:11:30 +0000</pubDate>
			<guid isPermaLink="false">https://www.gimp-forum.net/Thread-Windows-Gimp-3-0-symbol-entry</guid>
			<description><![CDATA[For adding a symbol to text in <span style="font-weight: bold;">Windows Gimp 3.0</span> the previous unicode entry does not work (it is more-or-less ok with linux).<br />
<br />
Two ways you might add a symbol<br />
<br />
(1) Copy and paste into the Gimp text window, typically using a character map.<br />
<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=13603" target="_blank" title="">01-char-map.jpg</a> (Size: 75.12 KB / Downloads: 605)
<!-- end: postbit_attachments_attachment --><br />
<br />
(2) One of the Gimp developers came up with this for Windows (must be in the MS documentation somewhere), putting a symbol straight into Gimp text.<br />
<br />
The Windows key + . (the period / full stop key) brings up this.<br />
<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=13604" target="_blank" title="">02- symbols.jpg</a> (Size: 138.93 KB / Downloads: 308)
<!-- end: postbit_attachments_attachment --><br />
<br />
There is a section for symbols, which narrows down selection a bit. Clicking on a symbol puts it straight into the Gimp text window, using the current font.<br />
<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=13605" target="_blank" title="">03-symbols.jpg</a> (Size: 147.24 KB / Downloads: 335)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[For adding a symbol to text in <span style="font-weight: bold;">Windows Gimp 3.0</span> the previous unicode entry does not work (it is more-or-less ok with linux).<br />
<br />
Two ways you might add a symbol<br />
<br />
(1) Copy and paste into the Gimp text window, typically using a character map.<br />
<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=13603" target="_blank" title="">01-char-map.jpg</a> (Size: 75.12 KB / Downloads: 605)
<!-- end: postbit_attachments_attachment --><br />
<br />
(2) One of the Gimp developers came up with this for Windows (must be in the MS documentation somewhere), putting a symbol straight into Gimp text.<br />
<br />
The Windows key + . (the period / full stop key) brings up this.<br />
<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=13604" target="_blank" title="">02- symbols.jpg</a> (Size: 138.93 KB / Downloads: 308)
<!-- end: postbit_attachments_attachment --><br />
<br />
There is a section for symbols, which narrows down selection a bit. Clicking on a symbol puts it straight into the Gimp text window, using the current font.<br />
<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=13605" target="_blank" title="">03-symbols.jpg</a> (Size: 147.24 KB / Downloads: 335)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Gimp Color Pixel Degrayscaler Tool]]></title>
			<link>https://www.gimp-forum.net/Thread-Gimp-Color-Pixel-Degrayscaler-Tool</link>
			<pubDate>Wed, 09 Apr 2025 23:08:29 +0000</pubDate>
			<guid isPermaLink="false">https://www.gimp-forum.net/Thread-Gimp-Color-Pixel-Degrayscaler-Tool</guid>
			<description><![CDATA[<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/xcf.png" title="Gimp XCF" border="0" alt=".xcf" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=13366" target="_blank" title="">ghsv1.xcf</a> (Size: 118.57 KB / Downloads: 349)
<!-- end: postbit_attachments_attachment --><br />
I made a color pixel degrayscaler tool for Gimp in 3.0.2/. It finds basic colors (R,G,B,C,M,Y) in hue,saturation &amp; value of pixels prior to grayscale conversion<br />
by looking at value of grayscale pixels &amp; matching them to non-grayscaled pixels in above mentioned colors so they can checked for RGB &amp; LCH channel values.<br />
<br />
<br />
<br />
Gimp Color Pixel Degrayscaler Tool<br />
<br />
What It Does<br />
<br />
Finds basic colors (R,G,B,C,M,Y) in hue,saturation &amp; value of pixels prior to grayscale conversion/full<br />
color desaturation by looking at value of grayscale pixels &amp; matching them to non-grayscaled/non-desaturated<br />
pixels in above mentioned colorsfor checking the RGB &amp; LCH channel values,plus how to colorize grayscale images using this tool.<br />
<br />
File Format<br />
<br />
Image is in XCF format.<br />
<br />
How To Use<br />
<br />
Download or save file,then open in Gimp  as XCF under the ghsv1.xcf file name (grayscale,hue,saturation,value for short)<br />
After opening in Gimp,make two duplicate images &amp; close original. Select second duplicate<br />
image,click Image &amp; convert to grayscale,copy grayscale duplicate &amp; paste it <br />
as layer in place to first duplicate image. Zoom to 1600%,scroll fully up<br />
then fully left with eye on background copy layer off. Use horizontal<br />
&amp; vertical position scales in image window (top &amp; left edges) &amp; in bottom left of image window,<br />
pixel position numbers with px selected. Image should appear as shown as follows:<br />
Beginning at 0 vertical position,grayscale value stripe,(gray value of 0 to 255)followed by two hue stripes,<br />
RGBCMY stripes for saturation,RGBCMY stripes for value. Color picker tool should be set<br />
to example,foreground color with use info window checked. Use select by color &amp;<br />
click on position (horizontal image scale) of grayscale stripe value pixel matching<br />
the position to locate value of pixel in your grayscale image as shown after<br />
selecting background copy as highlighted. Make certain that select by color tool<br />
is set to composite &amp; threshold set to 0.0 with other options such as antialiasing<br />
for example unchecked before doing above. Scroll right until highlighted selection areas<br />
in stripes are seen.(ex.91,3 referring to horizontal &amp; vertical positions <br />
of selected areas) &amp; select background layer if you're colorizing your grayscale image <br />
after converting it to RGB,then use color picker in the mentioned highlighted selection areas.<br />
<br />
Colorizing with Gimp Color Pixel Degrayscaler Tool<br />
<br />
<br />
I devised a way to colorize grayscale images after duplicating &amp; converting them to RGB.<br />
It uses a checkerboard pattern in a 3 by 3 pixel image. Use File,New &amp; set the vertical<br />
&amp; horizontal number of pixels to 3. Zoom to 1600% &amp; scroll to upper left corner.<br />
The three rows in the checkerboard pattern is follows: top row: RGB,<br />
middle row:GBR,bottom row:BRG. Don't forget to set pencil/brush tool to pencil &amp; pixel size to 1 for each of the nine pixels in the pattern. <br />
You can copy the pixel colors from the top row with the color picker,then pencil, &amp; use it with the pencil<br />
for the middle &amp; bottom rows of pixels. Next,set the ellipse/rectangle tool to rectangle &amp; draw a 3 by 3 pixel<br />
square around the pattern. Copy it then use the pattern image in edit to transfer it to the highlighted selection <br />
areas in the RGB converted duplicate of the grayscale image you're coloring. To begin coloring the mentioned grayscale image,<br />
zoom to 1600% as before &amp; again scroll to the upper left corner &amp; select the first pixel with select by color<br />
&amp; use the pattern image in edit as above. This is for Gimp 3 but can be used in the 2.10 versions.<br />
To  separately change the red,green &amp; blue pixels in the pattern,for example, click with color select on the red<br />
pixels in the mentioned checkerboard using "Use select by color &amp; click on position(horizontal image scale)..."<br />
as above in the tool image &amp; repeat the procedure for the green &amp; blue pixels in the checkerboard. (forgot to mention<br />
you need to use bucket fill set on fill whole image/selection when separately changing the red,green &amp; blue pixel colors<br />
in the checkerboard. <br />
<br />
<br />
I hope someone can speed up this coloring procedure by automating what parts of it can be automated &amp; doing things manually<br />
for the rest of it. This is not an AI tool. For example I uploaded a solid red image converted to grayscale &amp; some AI's,even online don't properly convert the image<br />
to the correct color for R255,G0,B0 values.]]></description>
			<content:encoded><![CDATA[<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/xcf.png" title="Gimp XCF" border="0" alt=".xcf" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=13366" target="_blank" title="">ghsv1.xcf</a> (Size: 118.57 KB / Downloads: 349)
<!-- end: postbit_attachments_attachment --><br />
I made a color pixel degrayscaler tool for Gimp in 3.0.2/. It finds basic colors (R,G,B,C,M,Y) in hue,saturation &amp; value of pixels prior to grayscale conversion<br />
by looking at value of grayscale pixels &amp; matching them to non-grayscaled pixels in above mentioned colors so they can checked for RGB &amp; LCH channel values.<br />
<br />
<br />
<br />
Gimp Color Pixel Degrayscaler Tool<br />
<br />
What It Does<br />
<br />
Finds basic colors (R,G,B,C,M,Y) in hue,saturation &amp; value of pixels prior to grayscale conversion/full<br />
color desaturation by looking at value of grayscale pixels &amp; matching them to non-grayscaled/non-desaturated<br />
pixels in above mentioned colorsfor checking the RGB &amp; LCH channel values,plus how to colorize grayscale images using this tool.<br />
<br />
File Format<br />
<br />
Image is in XCF format.<br />
<br />
How To Use<br />
<br />
Download or save file,then open in Gimp  as XCF under the ghsv1.xcf file name (grayscale,hue,saturation,value for short)<br />
After opening in Gimp,make two duplicate images &amp; close original. Select second duplicate<br />
image,click Image &amp; convert to grayscale,copy grayscale duplicate &amp; paste it <br />
as layer in place to first duplicate image. Zoom to 1600%,scroll fully up<br />
then fully left with eye on background copy layer off. Use horizontal<br />
&amp; vertical position scales in image window (top &amp; left edges) &amp; in bottom left of image window,<br />
pixel position numbers with px selected. Image should appear as shown as follows:<br />
Beginning at 0 vertical position,grayscale value stripe,(gray value of 0 to 255)followed by two hue stripes,<br />
RGBCMY stripes for saturation,RGBCMY stripes for value. Color picker tool should be set<br />
to example,foreground color with use info window checked. Use select by color &amp;<br />
click on position (horizontal image scale) of grayscale stripe value pixel matching<br />
the position to locate value of pixel in your grayscale image as shown after<br />
selecting background copy as highlighted. Make certain that select by color tool<br />
is set to composite &amp; threshold set to 0.0 with other options such as antialiasing<br />
for example unchecked before doing above. Scroll right until highlighted selection areas<br />
in stripes are seen.(ex.91,3 referring to horizontal &amp; vertical positions <br />
of selected areas) &amp; select background layer if you're colorizing your grayscale image <br />
after converting it to RGB,then use color picker in the mentioned highlighted selection areas.<br />
<br />
Colorizing with Gimp Color Pixel Degrayscaler Tool<br />
<br />
<br />
I devised a way to colorize grayscale images after duplicating &amp; converting them to RGB.<br />
It uses a checkerboard pattern in a 3 by 3 pixel image. Use File,New &amp; set the vertical<br />
&amp; horizontal number of pixels to 3. Zoom to 1600% &amp; scroll to upper left corner.<br />
The three rows in the checkerboard pattern is follows: top row: RGB,<br />
middle row:GBR,bottom row:BRG. Don't forget to set pencil/brush tool to pencil &amp; pixel size to 1 for each of the nine pixels in the pattern. <br />
You can copy the pixel colors from the top row with the color picker,then pencil, &amp; use it with the pencil<br />
for the middle &amp; bottom rows of pixels. Next,set the ellipse/rectangle tool to rectangle &amp; draw a 3 by 3 pixel<br />
square around the pattern. Copy it then use the pattern image in edit to transfer it to the highlighted selection <br />
areas in the RGB converted duplicate of the grayscale image you're coloring. To begin coloring the mentioned grayscale image,<br />
zoom to 1600% as before &amp; again scroll to the upper left corner &amp; select the first pixel with select by color<br />
&amp; use the pattern image in edit as above. This is for Gimp 3 but can be used in the 2.10 versions.<br />
To  separately change the red,green &amp; blue pixels in the pattern,for example, click with color select on the red<br />
pixels in the mentioned checkerboard using "Use select by color &amp; click on position(horizontal image scale)..."<br />
as above in the tool image &amp; repeat the procedure for the green &amp; blue pixels in the checkerboard. (forgot to mention<br />
you need to use bucket fill set on fill whole image/selection when separately changing the red,green &amp; blue pixel colors<br />
in the checkerboard. <br />
<br />
<br />
I hope someone can speed up this coloring procedure by automating what parts of it can be automated &amp; doing things manually<br />
for the rest of it. This is not an AI tool. For example I uploaded a solid red image converted to grayscale &amp; some AI's,even online don't properly convert the image<br />
to the correct color for R255,G0,B0 values.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Converting the API doc to Python]]></title>
			<link>https://www.gimp-forum.net/Thread-Converting-the-API-doc-to-Python</link>
			<pubDate>Thu, 03 Apr 2025 09:11:25 +0000</pubDate>
			<guid isPermaLink="false">https://www.gimp-forum.net/Thread-Converting-the-API-doc-to-Python</guid>
			<description><![CDATA[A little bit of C.<br />
<br />
In C you have two kinds of data types. <ul>
<li>The "native" ones: int and floats of various lengths, and pointers (memory addresses)<br />
</li>
<li>The "complex" ones (anything else, "structs" or arrays)<br />
</li></ul>
When you call a function:<ul>
<li>native types are passed "by value": their value is copied in the call stack<br />
</li>
<li>complex types are passed "by reference": a pointer to them is copied in the calls stack. The fact that this is a pointer is indicated by <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">*</span><br />
</li>
<li>the function can only "return" a single native type<br />
</li>
<li>the function can also update memory locations to which a pointer has been passed, this is how extra return values can be used<br />
</li></ul>
In addition: <ul>
<li>Except for constructors, in the C description the first argument of a class method is an object of the class<br />
</li>
<li>When used with Python object syntax, this first argument becomes the object on which the method is called (with of course, one less argument). <br />
</li>
<li>So for instance the method described in the doc as <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">do_something(SomeClass, arg1, arg2)</span> is called in Python as <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">instance_of_SomeClass.do_something(arg1,arg2)</span><br />
</li></ul>
For instance with this "C" prototype from the Gimp.Drawable description:<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>gboolean<br />
gimp_drawable_get_offsets (<br />
  GimpDrawable* drawable,<br />
  gint* offset_x,<br />
  gint* offset_y<br />
)</code></div></div>
<br />
Where <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">GimpDrawable</span> is a "complex" type, and <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">gboolean</span> and <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">gint</span> are "native" type (just  names for machine-size integers).<br />
<br />
* the function returns a boolean<br />
* the first argument is a pointer/reference to <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">GimpDrawable</span>. Since <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">GimpDrawable</span> is a complex type it is a simple "input" argument.<br />
* as stated above, since this is a method on <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Gimp.Drawable</span> in python it will be called on the object which is the first argument.<br />
* <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">offset_x</span> and <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">offset_y</span> are references to native types, and so are outputs to the function. In Python your inputs are immutable, so this is converted to extra return values, and the method returns a tuple.<br />
<br />
So this would be called as:<br />
<br />
<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">boolean_success, offset_x,offset_y= get_offsets(layer: Gimp.Drawable)</span><br />
<br />
But since the first argument is of the type described, in Python this method call on a  Gimp.Drawable object, so it is passed implicitly when calling the method.<br />
<br />
<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">boolean_success, offset_x,offset_y= layer.get_offsets()</span><br />
<br />
The returned boolean here is a bit artificial. This is probably because the method has to use output arguments to return X and Y, so this is the only way to check that the memory locations passed for the offsets have been updated. This can still be ignored in the vast majority of cases by writing:<br />
<br />
<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">_, offset_x,offset_y= layer.get_offsets()</span><br />
<br />
where <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">_</span> is the Python convention to indicate that you don't really care about this value.<br />
<br />
Slightly harder:<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>GimpLayer*<br />
gimp_image_get_layer_by_name (<br />
  GimpImage* image,<br />
  const gchar* name<br />
)</code></div></div>
<ul>
<li>The function takes a reference to a <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">GimpImage</span>, so in this case this is the implicit reference to the object on which the method is called.<br />
</li>
<li>The function takes a reference to <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">gchar</span>. This isn't an output for a single char, this is a reference to an array of characterss (arrays and pointer are equivalent in C, an array is defined by the address of its first element). And an array of <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">gchar</span> is... a string. What also indicates that this is an input-only argument is the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">const</span> modifier.<br />
</li>
<li>The call returns a pointer to a<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);"> GimpLayer</span>, so in Python, a plain Gimp.Layer<br />
 <br />
</li></ul>
So this defines a Gimp.Image method that would be type-hinted as:<br />
<br />
<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">def get_layer_by_name(name: str) -&gt; Gimp.Layer</span><br />
<br />
Raising the bar:<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>GimpLayer **<br />
gimp_image_get_selected_layers (<br />
  GimpImage* image<br />
)</code></div></div>
<br />
Here the call return a pointer to a pointer to GimpLayer... this is really a pointer to an array of GimpLayer, so for Python just a list of Gimp.Layer. So this is just:<br />
<br />
<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">def get_selected_layers() -&gt; list[Gimp.Layer]</span><br />
<br />
<span style="font-weight: bold;">Gotcha: </span><br />
<br />
Note that some calls are defined as <span style="font-weight: bold;">functions</span> and not as <span style="font-weight: bold;">object methods</span>. For instance:<br />
<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>gboolean<br />
gimp_file_save (<br />
  GimpRunMode run_mode,<br />
  GimpImage* image,<br />
  GFile* file,<br />
  GimpExportOptions* options<br />
)</code></div></div>
<br />
This is a plain function in the Gimp namespace that takes 4 explicit arguments.]]></description>
			<content:encoded><![CDATA[A little bit of C.<br />
<br />
In C you have two kinds of data types. <ul>
<li>The "native" ones: int and floats of various lengths, and pointers (memory addresses)<br />
</li>
<li>The "complex" ones (anything else, "structs" or arrays)<br />
</li></ul>
When you call a function:<ul>
<li>native types are passed "by value": their value is copied in the call stack<br />
</li>
<li>complex types are passed "by reference": a pointer to them is copied in the calls stack. The fact that this is a pointer is indicated by <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">*</span><br />
</li>
<li>the function can only "return" a single native type<br />
</li>
<li>the function can also update memory locations to which a pointer has been passed, this is how extra return values can be used<br />
</li></ul>
In addition: <ul>
<li>Except for constructors, in the C description the first argument of a class method is an object of the class<br />
</li>
<li>When used with Python object syntax, this first argument becomes the object on which the method is called (with of course, one less argument). <br />
</li>
<li>So for instance the method described in the doc as <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">do_something(SomeClass, arg1, arg2)</span> is called in Python as <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">instance_of_SomeClass.do_something(arg1,arg2)</span><br />
</li></ul>
For instance with this "C" prototype from the Gimp.Drawable description:<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>gboolean<br />
gimp_drawable_get_offsets (<br />
  GimpDrawable* drawable,<br />
  gint* offset_x,<br />
  gint* offset_y<br />
)</code></div></div>
<br />
Where <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">GimpDrawable</span> is a "complex" type, and <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">gboolean</span> and <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">gint</span> are "native" type (just  names for machine-size integers).<br />
<br />
* the function returns a boolean<br />
* the first argument is a pointer/reference to <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">GimpDrawable</span>. Since <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">GimpDrawable</span> is a complex type it is a simple "input" argument.<br />
* as stated above, since this is a method on <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Gimp.Drawable</span> in python it will be called on the object which is the first argument.<br />
* <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">offset_x</span> and <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">offset_y</span> are references to native types, and so are outputs to the function. In Python your inputs are immutable, so this is converted to extra return values, and the method returns a tuple.<br />
<br />
So this would be called as:<br />
<br />
<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">boolean_success, offset_x,offset_y= get_offsets(layer: Gimp.Drawable)</span><br />
<br />
But since the first argument is of the type described, in Python this method call on a  Gimp.Drawable object, so it is passed implicitly when calling the method.<br />
<br />
<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">boolean_success, offset_x,offset_y= layer.get_offsets()</span><br />
<br />
The returned boolean here is a bit artificial. This is probably because the method has to use output arguments to return X and Y, so this is the only way to check that the memory locations passed for the offsets have been updated. This can still be ignored in the vast majority of cases by writing:<br />
<br />
<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">_, offset_x,offset_y= layer.get_offsets()</span><br />
<br />
where <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">_</span> is the Python convention to indicate that you don't really care about this value.<br />
<br />
Slightly harder:<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>GimpLayer*<br />
gimp_image_get_layer_by_name (<br />
  GimpImage* image,<br />
  const gchar* name<br />
)</code></div></div>
<ul>
<li>The function takes a reference to a <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">GimpImage</span>, so in this case this is the implicit reference to the object on which the method is called.<br />
</li>
<li>The function takes a reference to <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">gchar</span>. This isn't an output for a single char, this is a reference to an array of characterss (arrays and pointer are equivalent in C, an array is defined by the address of its first element). And an array of <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">gchar</span> is... a string. What also indicates that this is an input-only argument is the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">const</span> modifier.<br />
</li>
<li>The call returns a pointer to a<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);"> GimpLayer</span>, so in Python, a plain Gimp.Layer<br />
 <br />
</li></ul>
So this defines a Gimp.Image method that would be type-hinted as:<br />
<br />
<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">def get_layer_by_name(name: str) -&gt; Gimp.Layer</span><br />
<br />
Raising the bar:<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>GimpLayer **<br />
gimp_image_get_selected_layers (<br />
  GimpImage* image<br />
)</code></div></div>
<br />
Here the call return a pointer to a pointer to GimpLayer... this is really a pointer to an array of GimpLayer, so for Python just a list of Gimp.Layer. So this is just:<br />
<br />
<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">def get_selected_layers() -&gt; list[Gimp.Layer]</span><br />
<br />
<span style="font-weight: bold;">Gotcha: </span><br />
<br />
Note that some calls are defined as <span style="font-weight: bold;">functions</span> and not as <span style="font-weight: bold;">object methods</span>. For instance:<br />
<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>gboolean<br />
gimp_file_save (<br />
  GimpRunMode run_mode,<br />
  GimpImage* image,<br />
  GFile* file,<br />
  GimpExportOptions* options<br />
)</code></div></div>
<br />
This is a plain function in the Gimp namespace that takes 4 explicit arguments.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[transform tools in action]]></title>
			<link>https://www.gimp-forum.net/Thread-transform-tools-in-action</link>
			<pubDate>Tue, 18 Mar 2025 09:57:47 +0000</pubDate>
			<guid isPermaLink="false">https://www.gimp-forum.net/Thread-transform-tools-in-action</guid>
			<description><![CDATA[How to use transform tools. Here PS but possible in gimp.<br />
<br />
<a href="https://www.youtube.com/watch?v=HAL_W6DGTUs" target="_blank">https://www.youtube.com/watch?v=HAL_W6DGTUs</a>]]></description>
			<content:encoded><![CDATA[How to use transform tools. Here PS but possible in gimp.<br />
<br />
<a href="https://www.youtube.com/watch?v=HAL_W6DGTUs" target="_blank">https://www.youtube.com/watch?v=HAL_W6DGTUs</a>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Non-destructive editing in Gimp3]]></title>
			<link>https://www.gimp-forum.net/Thread-Non-destructive-editing-in-Gimp3</link>
			<pubDate>Tue, 11 Mar 2025 13:20:22 +0000</pubDate>
			<guid isPermaLink="false">https://www.gimp-forum.net/Thread-Non-destructive-editing-in-Gimp3</guid>
			<description><![CDATA[Gimp V3 introduces "non destructive editing" (aka NDE).<br />
<br />
<br />
When you apply filters to layers, instead of altering the layer pixels immediately  (as done in V2), the filter can be added to  a stack of filters which is applied on the fly when Gimp uses the layer contents. When this is the case there is a "fx" icon next to the layer, and if you click on it you get the stack of current filters, that you can further edit. <br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=13181" target="_blank" title="">FilterStack.jpg</a> (Size: 97.23 KB / Downloads: 517)
<!-- end: postbit_attachments_attachment --></div>
<br />
This can be useful. For instance, in the image above, you can tweak the denoising and not lose the Exposure correction or the sharpening (and given that the trick is usually finding the right blend of denoising and sharpening this makes the workflow a lot more efficient). You can also decide that you will do Exposure before everything else by moving it down in the stack.<br />
<br />
Whether the filter is applied immediately or added to the stack is set by a "Merge filter" check box in the dialog:<br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=13182" target="_blank" title="">MergeButton.png</a> (Size: 33.54 KB / Downloads: 3374)
<!-- end: postbit_attachments_attachment --></div>
<br />
When the box is checked, the filter is applied immediately. This box only shows when you start the filter from the regular menus. If you edit the filter in the filter stack it is implicitly considered as "unmerged". <br />
<br />
If you apply the filter immediately it is applied before the filters in the stack.]]></description>
			<content:encoded><![CDATA[Gimp V3 introduces "non destructive editing" (aka NDE).<br />
<br />
<br />
When you apply filters to layers, instead of altering the layer pixels immediately  (as done in V2), the filter can be added to  a stack of filters which is applied on the fly when Gimp uses the layer contents. When this is the case there is a "fx" icon next to the layer, and if you click on it you get the stack of current filters, that you can further edit. <br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=13181" target="_blank" title="">FilterStack.jpg</a> (Size: 97.23 KB / Downloads: 517)
<!-- end: postbit_attachments_attachment --></div>
<br />
This can be useful. For instance, in the image above, you can tweak the denoising and not lose the Exposure correction or the sharpening (and given that the trick is usually finding the right blend of denoising and sharpening this makes the workflow a lot more efficient). You can also decide that you will do Exposure before everything else by moving it down in the stack.<br />
<br />
Whether the filter is applied immediately or added to the stack is set by a "Merge filter" check box in the dialog:<br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=13182" target="_blank" title="">MergeButton.png</a> (Size: 33.54 KB / Downloads: 3374)
<!-- end: postbit_attachments_attachment --></div>
<br />
When the box is checked, the filter is applied immediately. This box only shows when you start the filter from the regular menus. If you edit the filter in the filter stack it is implicitly considered as "unmerged". <br />
<br />
If you apply the filter immediately it is applied before the filters in the stack.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[LUT's - lookup tables : load, or make, and use]]></title>
			<link>https://www.gimp-forum.net/Thread-LUT-s-lookup-tables-load-or-make-and-use</link>
			<pubDate>Wed, 25 Sep 2024 17:52:24 +0000</pubDate>
			<guid isPermaLink="false">https://www.gimp-forum.net/Thread-LUT-s-lookup-tables-load-or-make-and-use</guid>
			<description><![CDATA[It is easy to correct or change the colours from a set of pictures with LUT's.<br />
What are LUT's or 'lookup tables', some information: <a href="https://nofilmschool.com/what-is-a-LUT" target="_blank">https://nofilmschool.com/what-is-a-LUT</a><br />
Free LUT's, one of the many free sites to download LUT's  : <a href="https://freshluts.com" target="_blank">https://freshluts.com</a> (register and download or post)<br />
Can one make LUT's? Yes, with G'Mic-Qt. <br />
- load a picture and make a layer copy<br />
- make a new layer and correct or change the colors in the layer copy<br />
- use G'Mic-Qt / Colors / CLUT from After - Before Layers<br />
- set the 'Output Mode': Save CLUT as cube or pngFile (use cube)<br />
- fill in 'Output Folder' (make a folder where you put all your 'cube' files) <br />
- fill in 'Output Name'  (a name that clarified what the LUT does - better for later use)<br />
- click on the 'OK' button<br />
The LUT can now be used for other pictures.<br />
- load a picture<br />
- G'Mic-Qt / Colors / Apply External CLUT<br />
- choose the 'HaldCLUT Filename (folder where you saved the cube file)<br />
- done<br />
Example (I used a LUT I made before from another corrected photo)<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=12386" target="_blank" title="">Roland Van Campenhout.jpg</a> (Size: 129.64 KB / Downloads: 698)
<!-- end: postbit_attachments_attachment --><br />
The Lut I used (cube file compressed):  <!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/7z.png" title="7z archive" border="0" alt=".7z" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=12387" target="_blank" title="">dran noa lee02.7z</a> (Size: 665 KB / Downloads: 542)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[It is easy to correct or change the colours from a set of pictures with LUT's.<br />
What are LUT's or 'lookup tables', some information: <a href="https://nofilmschool.com/what-is-a-LUT" target="_blank">https://nofilmschool.com/what-is-a-LUT</a><br />
Free LUT's, one of the many free sites to download LUT's  : <a href="https://freshluts.com" target="_blank">https://freshluts.com</a> (register and download or post)<br />
Can one make LUT's? Yes, with G'Mic-Qt. <br />
- load a picture and make a layer copy<br />
- make a new layer and correct or change the colors in the layer copy<br />
- use G'Mic-Qt / Colors / CLUT from After - Before Layers<br />
- set the 'Output Mode': Save CLUT as cube or pngFile (use cube)<br />
- fill in 'Output Folder' (make a folder where you put all your 'cube' files) <br />
- fill in 'Output Name'  (a name that clarified what the LUT does - better for later use)<br />
- click on the 'OK' button<br />
The LUT can now be used for other pictures.<br />
- load a picture<br />
- G'Mic-Qt / Colors / Apply External CLUT<br />
- choose the 'HaldCLUT Filename (folder where you saved the cube file)<br />
- done<br />
Example (I used a LUT I made before from another corrected photo)<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=12386" target="_blank" title="">Roland Van Campenhout.jpg</a> (Size: 129.64 KB / Downloads: 698)
<!-- end: postbit_attachments_attachment --><br />
The Lut I used (cube file compressed):  <!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/7z.png" title="7z archive" border="0" alt=".7z" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=12387" target="_blank" title="">dran noa lee02.7z</a> (Size: 665 KB / Downloads: 542)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[G'Mic-Qt Target Color Spot]]></title>
			<link>https://www.gimp-forum.net/Thread-G-Mic-Qt-Target-Color-Spot</link>
			<pubDate>Thu, 05 Sep 2024 15:56:29 +0000</pubDate>
			<guid isPermaLink="false">https://www.gimp-forum.net/Thread-G-Mic-Qt-Target-Color-Spot</guid>
			<description><![CDATA[I jus discovered G'Mic-Qt Target Color Spot. Nice to play with colours.<br />
<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=12334" target="_blank" title="">GMicQt Target Color Spot s.jpg</a> (Size: 95.95 KB / Downloads: 419)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[I jus discovered G'Mic-Qt Target Color Spot. Nice to play with colours.<br />
<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=12334" target="_blank" title="">GMicQt Target Color Spot s.jpg</a> (Size: 95.95 KB / Downloads: 419)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[What is the gamma encoding and why are my color computations wrong?]]></title>
			<link>https://www.gimp-forum.net/Thread-What-is-the-gamma-encoding-and-why-are-my-color-computations-wrong</link>
			<pubDate>Tue, 16 Jul 2024 19:25:50 +0000</pubDate>
			<guid isPermaLink="false">https://www.gimp-forum.net/Thread-What-is-the-gamma-encoding-and-why-are-my-color-computations-wrong</guid>
			<description><![CDATA[So, you tried to predict or emulate Gimp's behavior with math and failed. And you wonder why. You have come to the right place, take a seat and fasten you seat belt. Also, make sure you <span style="font-style: italic;"><span style="font-weight: bold;">check all ima</span></span><span style="font-style: italic;"><span style="font-weight: bold;">g</span></span><span style="font-style: italic;"><span style="font-weight: bold;">es at t</span></span><span style="font-style: italic;"><span style="font-weight: bold;">h</span></span><span style="font-style: italic;"><span style="font-weight: bold;">eir actual size</span></span> (click on them to see them in a separate tab, and make sure your browser is exactly 100% zoom) otherwise some examples could seem to demonstrate exactly the opposite of what is stated in the text.<br />
<br />
The root cause is that our eyes are not linear devices. If you double the power output (for instance, switch on a second light), you don't <span style="font-style: italic;">perceive</span> the room twice as bright. Somewhat brighter, yes, but certainly not twice as bright. Furthermore, our eyes are more sensitive to small differences between dark tones that between light ones.<br />
<br />
So, when pixel color values are encoded on a byte, encoding the physical output directly (which is what Gimp calls <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Linear light</span>) wastes precious bytes values encoding bright nuances we can't perceive, and leaves a handful of values to encode all the subtle darkness nuances we can distinguish.<br />
<br />
To avoid this, the values are encoded using a power law that has two nice advantages:<br />
<ul>
<li>The <span style="font-style: italic;">p</span><span style="font-style: italic;">erceived</span> "medium gray" is about half-scale<br />
</li>
<li>There are many more values to encode low luminosity levels<br />
</li></ul>
The theoretical law is <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">encoding = luminosity ** 2.2</span> (where a luminosity of 1.0 is maximum brightness) and then scaled to the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">[0 .. 255]</span> range. So for instance physical medium gray (<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">0.5</span>) becomes <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">(0.5 ** (1/2.2) ) * 255 = 186</span> (<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">#BA</span>) (the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">2.2</span> value is what is known as the "gamma"). <br />
<br />
In practice images are encoded using a slightly enhanced law called the <a href="https://en.wikipedia.org/wiki/SRGB#From_sRGB_to_CIE_XYZ" target="_blank"><span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">sRGB color space</span></a> where the "physical" medium gray is <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">#BC</span><br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=12155" target="_blank" title="">GammaCurve-Annotated.png</a> (Size: 68.84 KB / Downloads: 446)
<!-- end: postbit_attachments_attachment --></div>
<br />
So far, so good. So, where is the problem? <br />
<br />
The problem is that if the gamma-encoded values are a good way to store the values, they cannot be used directly to compute things. For instance, the average color of an area with an equal number of black (<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">#00</span>) and white (<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">#FF</span>) pixels is not #80. This area emits towards your eyes half the power of the fully white area, so its average color is the "physical" medium gray, not the "perceived" medium gray as demonstrated by the picture below (<span style="font-weight: bold;"><span style="font-style: italic;">that should be checked at full scale</span></span>(*)):<br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11076" target="_blank" title="">Gamma.png</a> (Size: 14.93 KB / Downloads: 487)
<!-- end: postbit_attachments_attachment --></div>
<br />
Which side is closer to the middle? In fact, making the square on the right indistinguishable from the one in the middle is a good way to tune your display...<br />
<br />
The rule is: when doing computations that are based on physical models (spoiler alert: most are), channel values should always be converted to physical values (Gimp's <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Linear light</span>) before any math is applied to them.<br />
<br />
This applies equally to the three color channels.  For instance if you do a red-green gradient, you would expect the midpoint of the gradient to be orange. <br />
<ul>
<li>In Gimp 2.10, it is so, because the middle of the gradient is where half the power is red and half the power is green. In other words, each color channel emits half the full scale, so the middle color is <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">#BCBC00</span>: <!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11078" target="_blank" title="">Red-Green-2.10.png</a> (Size: 2.55 KB / Downloads: 1747)
<!-- end: postbit_attachments_attachment --><br />
</li>
<li>In Gimp 2.8, working directly on the gamma values, the middle color is <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">#808000</span>, which is a much darker brown: <!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11077" target="_blank" title="">Red-Green-2.08.png</a> (Size: 642 bytes / Downloads: 1745)
<!-- end: postbit_attachments_attachment -->. <br />
</li></ul>
As an exercise for the reader, here is the averaging of a pattern with three colors. Click for full scale display otherwise your browser is showing you the wrong colors!<br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=12122" target="_blank" title="">ThreeColorAverage.png</a> (Size: 61.35 KB / Downloads: 1697)
<!-- end: postbit_attachments_attachment --></div>
<br />
<div style="text-align: left;">If you use <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Filters &gt; Blur &gt; Pixellize</span> on the pattern, you should obtain the same color. </div>
<br />
All these examples show that the direct  computation in the sRGB space produces results that are too dark. <br />
<br />
Some more notes:<br />
<ul>
<li>Gamma-encoding is mostly used in low-precision modes (8-bit (from most image formats) and 16-bit integer (from PNG)<br />
</li>
<li>Use of sRGB of course assumes that the images uses sRGB, if you load an image with another color profile, you have to use that color profile for the conversions.<br />
</li>
<li>If you use the <a href="https://docs.gimp.org/en/gimp-pointer-info-dialog.html" target="_blank">Pointer dialog</a> or the <a href="https://docs.gimp.org/en/gimp-sample-point-dialog.html" target="_blank">Sample Points</a> dialog you can ask for the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Pixel</span> representation, which in high-precision images is the actual <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">[0.0 .. 1.0]</span> linear light value.<br />
</li></ul>
Spreadsheet: <!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=12123" target="_blank" title="">GammaSpreadSheet.zip</a> (Size: 126.67 KB / Downloads: 853)
<!-- end: postbit_attachments_attachment --><ul>
<li>ODS format for maximum compatibility  <img src="https://www.gimp-forum.net/images/smilies/biggrin.png" alt="Big Grin" title="Big Grin" class="smilie smilie_4" />  <br />
</li>
<li>Contains macros, so macros have to be enabled<br />
</li>
<li>Shows formulas to convert from sRGB to linear and vice-versa<br />
</li>
<li>Also contains functions for the same (LINEAR2GAMMA and GAMMA2LINEAR) that take <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">[0 .. 1]</span> values and return <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">[0 .. 1]</span> values (in other words you still have to scale to from <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">[0 .. 255]</span> values, but as  a bonus it works with 16-bit values too...)<br />
</li></ul>
Python functions for same:<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>import sys,math<br />
<br />
def srgbToLinear(v255):<br />
    v=v255/255.<br />
    return v/12.92 if v &lt;= 0.04045 else math.pow((v+0.055)/1.055,2.4)<br />
<br />
def linearToSrgb(linear):<br />
    srgb=linear*12.92 if linear &lt; 0.0031308 else 1.055*math.pow(linear,1/2.4)-0.055<br />
    return 255*srgb</code></div></div>
<br />
(*) Browsers scale images using the sRGB values directly, so scaled images may end up darker than the original image. The three-color average example above is a good example. At native size the linear average (right square) is identical to the pattern at the top, but if the image is scaled by your browser (just zoom in/out) your browser will gamma-average the pattern at some point and make it look like the bottom left square.]]></description>
			<content:encoded><![CDATA[So, you tried to predict or emulate Gimp's behavior with math and failed. And you wonder why. You have come to the right place, take a seat and fasten you seat belt. Also, make sure you <span style="font-style: italic;"><span style="font-weight: bold;">check all ima</span></span><span style="font-style: italic;"><span style="font-weight: bold;">g</span></span><span style="font-style: italic;"><span style="font-weight: bold;">es at t</span></span><span style="font-style: italic;"><span style="font-weight: bold;">h</span></span><span style="font-style: italic;"><span style="font-weight: bold;">eir actual size</span></span> (click on them to see them in a separate tab, and make sure your browser is exactly 100% zoom) otherwise some examples could seem to demonstrate exactly the opposite of what is stated in the text.<br />
<br />
The root cause is that our eyes are not linear devices. If you double the power output (for instance, switch on a second light), you don't <span style="font-style: italic;">perceive</span> the room twice as bright. Somewhat brighter, yes, but certainly not twice as bright. Furthermore, our eyes are more sensitive to small differences between dark tones that between light ones.<br />
<br />
So, when pixel color values are encoded on a byte, encoding the physical output directly (which is what Gimp calls <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Linear light</span>) wastes precious bytes values encoding bright nuances we can't perceive, and leaves a handful of values to encode all the subtle darkness nuances we can distinguish.<br />
<br />
To avoid this, the values are encoded using a power law that has two nice advantages:<br />
<ul>
<li>The <span style="font-style: italic;">p</span><span style="font-style: italic;">erceived</span> "medium gray" is about half-scale<br />
</li>
<li>There are many more values to encode low luminosity levels<br />
</li></ul>
The theoretical law is <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">encoding = luminosity ** 2.2</span> (where a luminosity of 1.0 is maximum brightness) and then scaled to the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">[0 .. 255]</span> range. So for instance physical medium gray (<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">0.5</span>) becomes <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">(0.5 ** (1/2.2) ) * 255 = 186</span> (<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">#BA</span>) (the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">2.2</span> value is what is known as the "gamma"). <br />
<br />
In practice images are encoded using a slightly enhanced law called the <a href="https://en.wikipedia.org/wiki/SRGB#From_sRGB_to_CIE_XYZ" target="_blank"><span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">sRGB color space</span></a> where the "physical" medium gray is <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">#BC</span><br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=12155" target="_blank" title="">GammaCurve-Annotated.png</a> (Size: 68.84 KB / Downloads: 446)
<!-- end: postbit_attachments_attachment --></div>
<br />
So far, so good. So, where is the problem? <br />
<br />
The problem is that if the gamma-encoded values are a good way to store the values, they cannot be used directly to compute things. For instance, the average color of an area with an equal number of black (<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">#00</span>) and white (<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">#FF</span>) pixels is not #80. This area emits towards your eyes half the power of the fully white area, so its average color is the "physical" medium gray, not the "perceived" medium gray as demonstrated by the picture below (<span style="font-weight: bold;"><span style="font-style: italic;">that should be checked at full scale</span></span>(*)):<br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11076" target="_blank" title="">Gamma.png</a> (Size: 14.93 KB / Downloads: 487)
<!-- end: postbit_attachments_attachment --></div>
<br />
Which side is closer to the middle? In fact, making the square on the right indistinguishable from the one in the middle is a good way to tune your display...<br />
<br />
The rule is: when doing computations that are based on physical models (spoiler alert: most are), channel values should always be converted to physical values (Gimp's <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Linear light</span>) before any math is applied to them.<br />
<br />
This applies equally to the three color channels.  For instance if you do a red-green gradient, you would expect the midpoint of the gradient to be orange. <br />
<ul>
<li>In Gimp 2.10, it is so, because the middle of the gradient is where half the power is red and half the power is green. In other words, each color channel emits half the full scale, so the middle color is <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">#BCBC00</span>: <!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11078" target="_blank" title="">Red-Green-2.10.png</a> (Size: 2.55 KB / Downloads: 1747)
<!-- end: postbit_attachments_attachment --><br />
</li>
<li>In Gimp 2.8, working directly on the gamma values, the middle color is <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">#808000</span>, which is a much darker brown: <!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11077" target="_blank" title="">Red-Green-2.08.png</a> (Size: 642 bytes / Downloads: 1745)
<!-- end: postbit_attachments_attachment -->. <br />
</li></ul>
As an exercise for the reader, here is the averaging of a pattern with three colors. Click for full scale display otherwise your browser is showing you the wrong colors!<br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=12122" target="_blank" title="">ThreeColorAverage.png</a> (Size: 61.35 KB / Downloads: 1697)
<!-- end: postbit_attachments_attachment --></div>
<br />
<div style="text-align: left;">If you use <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Filters &gt; Blur &gt; Pixellize</span> on the pattern, you should obtain the same color. </div>
<br />
All these examples show that the direct  computation in the sRGB space produces results that are too dark. <br />
<br />
Some more notes:<br />
<ul>
<li>Gamma-encoding is mostly used in low-precision modes (8-bit (from most image formats) and 16-bit integer (from PNG)<br />
</li>
<li>Use of sRGB of course assumes that the images uses sRGB, if you load an image with another color profile, you have to use that color profile for the conversions.<br />
</li>
<li>If you use the <a href="https://docs.gimp.org/en/gimp-pointer-info-dialog.html" target="_blank">Pointer dialog</a> or the <a href="https://docs.gimp.org/en/gimp-sample-point-dialog.html" target="_blank">Sample Points</a> dialog you can ask for the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Pixel</span> representation, which in high-precision images is the actual <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">[0.0 .. 1.0]</span> linear light value.<br />
</li></ul>
Spreadsheet: <!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=12123" target="_blank" title="">GammaSpreadSheet.zip</a> (Size: 126.67 KB / Downloads: 853)
<!-- end: postbit_attachments_attachment --><ul>
<li>ODS format for maximum compatibility  <img src="https://www.gimp-forum.net/images/smilies/biggrin.png" alt="Big Grin" title="Big Grin" class="smilie smilie_4" />  <br />
</li>
<li>Contains macros, so macros have to be enabled<br />
</li>
<li>Shows formulas to convert from sRGB to linear and vice-versa<br />
</li>
<li>Also contains functions for the same (LINEAR2GAMMA and GAMMA2LINEAR) that take <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">[0 .. 1]</span> values and return <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">[0 .. 1]</span> values (in other words you still have to scale to from <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">[0 .. 255]</span> values, but as  a bonus it works with 16-bit values too...)<br />
</li></ul>
Python functions for same:<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>import sys,math<br />
<br />
def srgbToLinear(v255):<br />
    v=v255/255.<br />
    return v/12.92 if v &lt;= 0.04045 else math.pow((v+0.055)/1.055,2.4)<br />
<br />
def linearToSrgb(linear):<br />
    srgb=linear*12.92 if linear &lt; 0.0031308 else 1.055*math.pow(linear,1/2.4)-0.055<br />
    return 255*srgb</code></div></div>
<br />
(*) Browsers scale images using the sRGB values directly, so scaled images may end up darker than the original image. The three-color average example above is a good example. At native size the linear average (right square) is identical to the pattern at the top, but if the image is scaled by your browser (just zoom in/out) your browser will gamma-average the pattern at some point and make it look like the bottom left square.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Fill by line art with perfect edges on a B&W image or vice-versa]]></title>
			<link>https://www.gimp-forum.net/Thread-Fill-by-line-art-with-perfect-edges-on-a-B-W-image-or-vice-versa</link>
			<pubDate>Sat, 13 Jul 2024 05:58:25 +0000</pubDate>
			<guid isPermaLink="false">https://www.gimp-forum.net/Thread-Fill-by-line-art-with-perfect-edges-on-a-B-W-image-or-vice-versa</guid>
			<description><![CDATA[No method is wrong, but some time I see convoluted methods to bucket fill with line art detection <span style="font-weight: bold;">when there is a BackGround</span>, where it can be extremely simple to bucket fill with line art detection and get perfect edges even with a BG.<br />
Thus I'll show you one simple way <span style="font-weight: bold;"><span style="text-decoration: underline;">without deleting any BackGround</span></span>, no selection, no mode change in your tool settings.<br />
<br />
GIMP has a layer mode in which we are interested, it's the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Multiply</span> mode for white BG <span style="font-weight: bold;"><span style="text-decoration: underline;">or</span></span> its opposite <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Screen</span> mode for black BG<br />
<br />
Get you image in GIMP, then:<br />
<ol type="1">
<li>Create a new white layer (if the BG is white), and put it at the bottom<br />
</li>
<li>Create a transparent layer above the white layer<br />
</li>
<li>Put the top layer (original image) in <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Multiply</span> mode (<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Screen</span> mode for black BG)<br />
</li>
<li>Bucket fill by line art the transparent layer<br />
</li></ol>
Done, perfect edges!<br />
<br />
<!-- start: video_youtube_embed --><br />
<iframe width="560" height="315" src="//www.youtube.com/embed/WEKow9bqtyk" frameborder="0" allowfullscreen></iframe><br />
<!-- end: video_youtube_embed -->]]></description>
			<content:encoded><![CDATA[No method is wrong, but some time I see convoluted methods to bucket fill with line art detection <span style="font-weight: bold;">when there is a BackGround</span>, where it can be extremely simple to bucket fill with line art detection and get perfect edges even with a BG.<br />
Thus I'll show you one simple way <span style="font-weight: bold;"><span style="text-decoration: underline;">without deleting any BackGround</span></span>, no selection, no mode change in your tool settings.<br />
<br />
GIMP has a layer mode in which we are interested, it's the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Multiply</span> mode for white BG <span style="font-weight: bold;"><span style="text-decoration: underline;">or</span></span> its opposite <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Screen</span> mode for black BG<br />
<br />
Get you image in GIMP, then:<br />
<ol type="1">
<li>Create a new white layer (if the BG is white), and put it at the bottom<br />
</li>
<li>Create a transparent layer above the white layer<br />
</li>
<li>Put the top layer (original image) in <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Multiply</span> mode (<span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Screen</span> mode for black BG)<br />
</li>
<li>Bucket fill by line art the transparent layer<br />
</li></ol>
Done, perfect edges!<br />
<br />
<!-- start: video_youtube_embed --><br />
<iframe width="560" height="315" src="//www.youtube.com/embed/WEKow9bqtyk" frameborder="0" allowfullscreen></iframe><br />
<!-- end: video_youtube_embed -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Moving a dock in 4 easy steps]]></title>
			<link>https://www.gimp-forum.net/Thread-Moving-a-dock-in-4-easy-steps</link>
			<pubDate>Tue, 28 May 2024 17:28:09 +0000</pubDate>
			<guid isPermaLink="false">https://www.gimp-forum.net/Thread-Moving-a-dock-in-4-easy-steps</guid>
			<description><![CDATA[<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11932" target="_blank" title="">DraggingDocks.png</a> (Size: 112.09 KB / Downloads: 453)
<!-- end: postbit_attachments_attachment --><br />
<br />
(click for full size)]]></description>
			<content:encoded><![CDATA[<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11932" target="_blank" title="">DraggingDocks.png</a> (Size: 112.09 KB / Downloads: 453)
<!-- end: postbit_attachments_attachment --><br />
<br />
(click for full size)]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Getting active image and layer in Python scripts]]></title>
			<link>https://www.gimp-forum.net/Thread-Getting-active-image-and-layer-in-Python-scripts</link>
			<pubDate>Thu, 02 May 2024 07:32:44 +0000</pubDate>
			<guid isPermaLink="false">https://www.gimp-forum.net/Thread-Getting-active-image-and-layer-in-Python-scripts</guid>
			<description><![CDATA[If your script is correctly written, in particular its "registration" code, it gets the active image (and the active layer) as parameters:<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>#!/usr/bin/python<br />
# -*- coding: UTF-8 -*-<br />
<br />
from gimpfu import *<br />
<br />
def theCode(theImage,theDrawable):<br />
    pdb.gimp_message('Running on image "%s" (%d) on drawable "%s"' &#92;<br />
        % (theImage.name,theImage.ID,theDrawable.name))<br />
    <br />
register(<br />
    'the_registration_atom',<br />
    'Example registration of a python plugin (short description, pops up in menus)',<br />
    'Example registration of a python plugin (long-winded help that shows in the PDB browser)',<br />
    'Author','Copyright owner','2021',<br />
    'Test menu item',<br />
    '*', # works on all image types<br />
    [<br />
        (PF_IMAGE, "image", "Input image", None),           # Active image if called from the UI<br />
        (PF_DRAWABLE, "drawable", "Input drawable", None),  # Active drawable if called from the UI<br />
        # Other parameters would come here<br />
    ],<br />
    [<br />
        # if you want to be really nice and your script creates image/layers, you can return<br />
        # then and descrive their type here. Makes it easier for other scripts calling your script.<br />
    ],<br />
    theCode,<br />
    menu='&lt;Image&gt;/Test/',<br />
)<br />
<br />
main()</code></div></div>
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11784" target="_blank" title="">registration.png</a> (Size: 135.2 KB / Downloads: 584)
<!-- end: postbit_attachments_attachment --></div>
<br />
Notes:<br />
<ul>
<li>An important part is the use of the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">menu</span> named argument. This makes the registration use the new variant. The older variant where the 7th argument is a full path to the menu item (which is still found in some examples) behaves a bit differently.<br />
</li>
<li>The "drawable" can be a layer (usual case) but also a layer mask or a channel or even a layer group. Some scripts can work on all types, others may want just a layer. You can use a <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">PF_LAYER</span> instead of a <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">PF_DRAWABLE</span> but the Gimp error message isn't too user-friendly. Better check in your code and react appropriately.<br />
</li>
<li>Since the script works on a drawable, the menu item is disabled if there is no active drawable in the image (this can happen after you deleted all layers). You can of course remove the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">drawable</span> argument if the script doesn't require a specific drawable (runs on all layers, or generates new ones)<br />
</li>
<li>Since the script works on an image, the menu item is disabled if there is no image in Gimp.  You can of course remove the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">image</span> argument if the script doesn't require a specific image (runs on all images, or loads/generates new ones)<br />
</li></ul>
An example script "core" with long-winded comments: <!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11788" target="_blank" title="">regdemo.zip</a> (Size: 2.2 KB / Downloads: 866)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[If your script is correctly written, in particular its "registration" code, it gets the active image (and the active layer) as parameters:<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>#!/usr/bin/python<br />
# -*- coding: UTF-8 -*-<br />
<br />
from gimpfu import *<br />
<br />
def theCode(theImage,theDrawable):<br />
    pdb.gimp_message('Running on image "%s" (%d) on drawable "%s"' &#92;<br />
        % (theImage.name,theImage.ID,theDrawable.name))<br />
    <br />
register(<br />
    'the_registration_atom',<br />
    'Example registration of a python plugin (short description, pops up in menus)',<br />
    'Example registration of a python plugin (long-winded help that shows in the PDB browser)',<br />
    'Author','Copyright owner','2021',<br />
    'Test menu item',<br />
    '*', # works on all image types<br />
    [<br />
        (PF_IMAGE, "image", "Input image", None),           # Active image if called from the UI<br />
        (PF_DRAWABLE, "drawable", "Input drawable", None),  # Active drawable if called from the UI<br />
        # Other parameters would come here<br />
    ],<br />
    [<br />
        # if you want to be really nice and your script creates image/layers, you can return<br />
        # then and descrive their type here. Makes it easier for other scripts calling your script.<br />
    ],<br />
    theCode,<br />
    menu='&lt;Image&gt;/Test/',<br />
)<br />
<br />
main()</code></div></div>
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11784" target="_blank" title="">registration.png</a> (Size: 135.2 KB / Downloads: 584)
<!-- end: postbit_attachments_attachment --></div>
<br />
Notes:<br />
<ul>
<li>An important part is the use of the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">menu</span> named argument. This makes the registration use the new variant. The older variant where the 7th argument is a full path to the menu item (which is still found in some examples) behaves a bit differently.<br />
</li>
<li>The "drawable" can be a layer (usual case) but also a layer mask or a channel or even a layer group. Some scripts can work on all types, others may want just a layer. You can use a <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">PF_LAYER</span> instead of a <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">PF_DRAWABLE</span> but the Gimp error message isn't too user-friendly. Better check in your code and react appropriately.<br />
</li>
<li>Since the script works on a drawable, the menu item is disabled if there is no active drawable in the image (this can happen after you deleted all layers). You can of course remove the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">drawable</span> argument if the script doesn't require a specific drawable (runs on all layers, or generates new ones)<br />
</li>
<li>Since the script works on an image, the menu item is disabled if there is no image in Gimp.  You can of course remove the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">image</span> argument if the script doesn't require a specific image (runs on all images, or loads/generates new ones)<br />
</li></ul>
An example script "core" with long-winded comments: <!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11788" target="_blank" title="">regdemo.zip</a> (Size: 2.2 KB / Downloads: 866)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Easy quick photo type painting]]></title>
			<link>https://www.gimp-forum.net/Thread-Easy-quick-photo-type-painting</link>
			<pubDate>Sun, 31 Mar 2024 22:26:08 +0000</pubDate>
			<guid isPermaLink="false">https://www.gimp-forum.net/Thread-Easy-quick-photo-type-painting</guid>
			<description><![CDATA[Heres a tutorial I put together,   if u want to make art like me, its kinda fun and quick.<br />
<br />
<a href="https://www.youtube.com/watch?v=mWq9ca9jGQo" target="_blank">https://www.youtube.com/watch?v=mWq9ca9jGQo</a>]]></description>
			<content:encoded><![CDATA[Heres a tutorial I put together,   if u want to make art like me, its kinda fun and quick.<br />
<br />
<a href="https://www.youtube.com/watch?v=mWq9ca9jGQo" target="_blank">https://www.youtube.com/watch?v=mWq9ca9jGQo</a>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Dynamics]]></title>
			<link>https://www.gimp-forum.net/Thread-Dynamics--8835</link>
			<pubDate>Sun, 03 Mar 2024 16:34:45 +0000</pubDate>
			<guid isPermaLink="false">https://www.gimp-forum.net/Thread-Dynamics--8835</guid>
			<description><![CDATA[Dynamics are a way to change some brush charactertistic(s) in the fly using more hints than just the pointer position. The hints are:<br />
<ul>
<li><span style="font-weight: bold;">P</span><span style="font-weight: bold;">ressure</span>: the pressure on the stylus (this requires an adequately configured tablet)<br />
</li>
<li><span style="font-weight: bold;">V</span><span style="font-weight: bold;">eloci</span><span style="font-weight: bold;">ty</span>:  how fast the pointer moves<br />
</li>
<li><span style="font-weight: bold;">D</span><span style="font-weight: bold;">irection</span>:  where the pointer goes<br />
</li>
<li><span style="font-weight: bold;">T</span><span style="font-weight: bold;">ilt</span>:  inclination of the stylus, on advanced tablets<br />
</li>
<li><span style="font-weight: bold;">Wheel/rotation</span>:  I don't know what that is but I assume this is also for advanced tablets<br />
</li>
<li><span style="font-weight: bold;">Random</span>: not a physical input, just a random value between 0 and 100%<br />
</li>
<li><span style="font-weight: bold;">Fade</span>: the distance since the beginning of the stroke, as a percent of the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Fade length</span> configured in the paint tool (this repeats)<br />
</li></ul>
In practice with a mouse the only usable ones are Direction, Random, and  Fade (and Velocity if you are really skilled). <br />
<br />
These hints can be applied to the following characteristics:<br />
<ul>
<li><span style="font-weight: bold;">Opacity</span>: from 0 to 100% of configured opacity<br />
</li>
<li><span style="font-weight: bold;">Size</span>: from 0 to 100% of the configured brush size<br />
</li>
<li><span style="font-weight: bold;">Angle</span>: from 0° to 360°: warning: the median setting is 180°, which is an upside-down brush, so for some mapping it is useful to use an upside-down brush.<br />
</li>
<li><span style="font-weight: bold;">Color</span>: a color is sampled from the active gradient<br />
</li>
<li><span style="font-weight: bold;">Hardness</span><br />
</li>
<li><span style="font-weight: bold;">Force</span><br />
</li>
<li><span style="font-weight: bold;">Aspect</span><span style="font-weight: bold;"> ratio</span>: from "0" (circular brush) to whatever is configured for the brush<br />
</li>
<li><span style="font-weight: bold;">Spacing</span>: from 200% spacing to the configured spacing<br />
</li>
<li><span style="font-weight: bold;">Rate</span><br />
</li>
<li><span style="font-weight: bold;">Flow</span><br />
</li>
<li><span style="font-weight: bold;">Jitter</span><br />
</li></ul>
You define all this by editing/creating a Dynamics (as with other Gimp resources, you cannot edit the standard one, you have to make a copy first).<br />
<br />
The first thing to do in a Dynamic is to define the mapping matrix. To control a given characteristic using a given hint, you just check the box that is at the intersection of the "hint" and the "characteristic". The example below associates <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Size</span> with <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Random</span> (so the size is random), and the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Color</span> with <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Fade</span> (so the color is taken from a gradient as the pointer advances). A hint can apply to several characteristics (so you could have random size and color) and a characteristic can depend on several hints (but good luck predicting how this behaves).<br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11355" target="_blank" title="">Dynamics1.png</a> (Size: 156.91 KB / Downloads: 486)
<!-- end: postbit_attachments_attachment --></div>
<br />
You can define more finely how the hint is applied to change the characteristic by changing the mapping curve:<br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11357" target="_blank" title="">Dynamics2.png</a> (Size: 111.92 KB / Downloads: 499)
<!-- end: postbit_attachments_attachment --></div>
<br />
<div style="text-align: left;">For instance, in the image above, the red-green part of the gradient is mapped to smaller part of the input range than the green-blue part, while the blue-red is not mapped at all, so the output favors mostly the green-blue part.</div>
<br />
<div style="text-align: left;">Gimp comes if a  collection of pre-set dynamics, a very useful one is <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Track direction</span>, where the brush angle is rotated according to the stroke direction, so the brush keeps the same orientation relative to the stroke instead of remaining upright all along.</div>
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11358" target="_blank" title="">Dynamics3.png</a> (Size: 45.43 KB / Downloads: 656)
<!-- end: postbit_attachments_attachment --></div>]]></description>
			<content:encoded><![CDATA[Dynamics are a way to change some brush charactertistic(s) in the fly using more hints than just the pointer position. The hints are:<br />
<ul>
<li><span style="font-weight: bold;">P</span><span style="font-weight: bold;">ressure</span>: the pressure on the stylus (this requires an adequately configured tablet)<br />
</li>
<li><span style="font-weight: bold;">V</span><span style="font-weight: bold;">eloci</span><span style="font-weight: bold;">ty</span>:  how fast the pointer moves<br />
</li>
<li><span style="font-weight: bold;">D</span><span style="font-weight: bold;">irection</span>:  where the pointer goes<br />
</li>
<li><span style="font-weight: bold;">T</span><span style="font-weight: bold;">ilt</span>:  inclination of the stylus, on advanced tablets<br />
</li>
<li><span style="font-weight: bold;">Wheel/rotation</span>:  I don't know what that is but I assume this is also for advanced tablets<br />
</li>
<li><span style="font-weight: bold;">Random</span>: not a physical input, just a random value between 0 and 100%<br />
</li>
<li><span style="font-weight: bold;">Fade</span>: the distance since the beginning of the stroke, as a percent of the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Fade length</span> configured in the paint tool (this repeats)<br />
</li></ul>
In practice with a mouse the only usable ones are Direction, Random, and  Fade (and Velocity if you are really skilled). <br />
<br />
These hints can be applied to the following characteristics:<br />
<ul>
<li><span style="font-weight: bold;">Opacity</span>: from 0 to 100% of configured opacity<br />
</li>
<li><span style="font-weight: bold;">Size</span>: from 0 to 100% of the configured brush size<br />
</li>
<li><span style="font-weight: bold;">Angle</span>: from 0° to 360°: warning: the median setting is 180°, which is an upside-down brush, so for some mapping it is useful to use an upside-down brush.<br />
</li>
<li><span style="font-weight: bold;">Color</span>: a color is sampled from the active gradient<br />
</li>
<li><span style="font-weight: bold;">Hardness</span><br />
</li>
<li><span style="font-weight: bold;">Force</span><br />
</li>
<li><span style="font-weight: bold;">Aspect</span><span style="font-weight: bold;"> ratio</span>: from "0" (circular brush) to whatever is configured for the brush<br />
</li>
<li><span style="font-weight: bold;">Spacing</span>: from 200% spacing to the configured spacing<br />
</li>
<li><span style="font-weight: bold;">Rate</span><br />
</li>
<li><span style="font-weight: bold;">Flow</span><br />
</li>
<li><span style="font-weight: bold;">Jitter</span><br />
</li></ul>
You define all this by editing/creating a Dynamics (as with other Gimp resources, you cannot edit the standard one, you have to make a copy first).<br />
<br />
The first thing to do in a Dynamic is to define the mapping matrix. To control a given characteristic using a given hint, you just check the box that is at the intersection of the "hint" and the "characteristic". The example below associates <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Size</span> with <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Random</span> (so the size is random), and the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Color</span> with <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Fade</span> (so the color is taken from a gradient as the pointer advances). A hint can apply to several characteristics (so you could have random size and color) and a characteristic can depend on several hints (but good luck predicting how this behaves).<br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11355" target="_blank" title="">Dynamics1.png</a> (Size: 156.91 KB / Downloads: 486)
<!-- end: postbit_attachments_attachment --></div>
<br />
You can define more finely how the hint is applied to change the characteristic by changing the mapping curve:<br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11357" target="_blank" title="">Dynamics2.png</a> (Size: 111.92 KB / Downloads: 499)
<!-- end: postbit_attachments_attachment --></div>
<br />
<div style="text-align: left;">For instance, in the image above, the red-green part of the gradient is mapped to smaller part of the input range than the green-blue part, while the blue-red is not mapped at all, so the output favors mostly the green-blue part.</div>
<br />
<div style="text-align: left;">Gimp comes if a  collection of pre-set dynamics, a very useful one is <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Track direction</span>, where the brush angle is rotated according to the stroke direction, so the brush keeps the same orientation relative to the stroke instead of remaining upright all along.</div>
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11358" target="_blank" title="">Dynamics3.png</a> (Size: 45.43 KB / Downloads: 656)
<!-- end: postbit_attachments_attachment --></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Why is the Move tool moving the wrong layer?]]></title>
			<link>https://www.gimp-forum.net/Thread-Why-is-the-Move-tool-moving-the-wrong-layer</link>
			<pubDate>Tue, 23 Jan 2024 08:43:18 +0000</pubDate>
			<guid isPermaLink="false">https://www.gimp-forum.net/Thread-Why-is-the-Move-tool-moving-the-wrong-layer</guid>
			<description><![CDATA[By default, the Move tool auto-picks the layer of the top most-non transparent pixel where you click. So, starting with such an image:<br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11054" target="_blank" title="">Move-source.png</a> (Size: 32.74 KB / Downloads: 445)
<!-- end: postbit_attachments_attachment --></div>
<br />
Depending on where you click the Move tool will pick a different layer:<br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11055" target="_blank" title="">Move-perspective .png</a> (Size: 36.65 KB / Downloads: 1030)
<!-- end: postbit_attachments_attachment --></div>
<br />
This can be disconcerting at times because if you click at random in text, you could be clicking on a transparent spot (for instance, inside the D or O above) and so selecting a layer below (the background or the green spot), which will make the move tool move that layer and not the text layer.<br />
<br />
So, to move text, you have  to click on the characters themselves (or on any opaque part of the layer, but this is what we are naturally doing most of the time for non-text layers). <br />
<br />
In case of dire need, you can make the Move tool act on  the active layer: <br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11056" target="_blank" title="">Move-options.png</a> (Size: 27.9 KB / Downloads: 1015)
<!-- end: postbit_attachments_attachment --></div>
<br />
<div style="text-align: left;">But instead of checking the tool option, you can also just start the drag with a shift-click. It is usually a bad idea to set the tool permanently in the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Move active layer</span> mode, because it makes arranging several layers very cumbersome. </div>
<br />
Finally, remember that in the Text tool, you can move the layer you are editing by Alt-Control-drag (independently of where you click).]]></description>
			<content:encoded><![CDATA[By default, the Move tool auto-picks the layer of the top most-non transparent pixel where you click. So, starting with such an image:<br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11054" target="_blank" title="">Move-source.png</a> (Size: 32.74 KB / Downloads: 445)
<!-- end: postbit_attachments_attachment --></div>
<br />
Depending on where you click the Move tool will pick a different layer:<br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11055" target="_blank" title="">Move-perspective .png</a> (Size: 36.65 KB / Downloads: 1030)
<!-- end: postbit_attachments_attachment --></div>
<br />
This can be disconcerting at times because if you click at random in text, you could be clicking on a transparent spot (for instance, inside the D or O above) and so selecting a layer below (the background or the green spot), which will make the move tool move that layer and not the text layer.<br />
<br />
So, to move text, you have  to click on the characters themselves (or on any opaque part of the layer, but this is what we are naturally doing most of the time for non-text layers). <br />
<br />
In case of dire need, you can make the Move tool act on  the active layer: <br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=11056" target="_blank" title="">Move-options.png</a> (Size: 27.9 KB / Downloads: 1015)
<!-- end: postbit_attachments_attachment --></div>
<br />
<div style="text-align: left;">But instead of checking the tool option, you can also just start the drag with a shift-click. It is usually a bad idea to set the tool permanently in the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Move active layer</span> mode, because it makes arranging several layers very cumbersome. </div>
<br />
Finally, remember that in the Text tool, you can move the layer you are editing by Alt-Control-drag (independently of where you click).]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[What your mom never told you about PNG compression levels]]></title>
			<link>https://www.gimp-forum.net/Thread-What-your-mom-never-told-you-about-PNG-compression-levels</link>
			<pubDate>Mon, 06 Nov 2023 12:59:56 +0000</pubDate>
			<guid isPermaLink="false">https://www.gimp-forum.net/Thread-What-your-mom-never-told-you-about-PNG-compression-levels</guid>
			<description><![CDATA[The PNG compression level is that setting in the PNG options that is set by default to 9 and that everyone keeps that way. <br />
<br />
But what is its purpose anyway since the compression is lossless? Once decompressed the image is still the same whatever the setting? So why is it an option?<br />
<br />
It happens that the PNG compression algorithm is quite CPU-intensive so this setting tells the algorithm how hard it should try to find things to compress. Unlike JPEG where you trade file size for image quality, in the PNG format you trade file size for CPU during export, and on big images it makes quite a difference. So lets see what happens with four different images (16Mpix each except the photo which is 14Mpx):<br />
<ul>
<li>A plain text (8 lines in a text layer with a large font), which is expected to compress very well (PNG is designed to be efficient on computer-generate images)<br />
</li>
<li>A Simplex noise which is random but with a large proportion of pure black pixels (about 50%) <br />
</li>
<li>A Plasma noise which is also truly random but is made slightly less random by applying a small median blur to it.<br />
</li>
<li>A photo of a gorgeous French village.<br />
</li></ul>
Each image was exported (without alpha channel) in the 10 levels of compression, measuring the final file size and execution time. Then the results were plotted, using the size relative to the uncompressed version and the relative time to compress:<br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=10560" target="_blank" title="">CompositePlot.png</a> (Size: 100.48 KB / Downloads: 1846)
<!-- end: postbit_attachments_attachment --></div>
<br />
For instance, in the Simplex case, the final size with compression is about 20% of the uncompressed size, and for level 7 the export took about 5 times longer than the uncompressed export. <br />
<br />
These curves make it clear that in all cases, some compression is better than no compression at all.  However, past levels 4-5, there is a very substantial increase in compression time for little or no gain on the file size. In absolute numbers, given that the uncompressed export took a good half second, level 9 is nearly 18 seconds for the photo, when level 6, that produces a file which is less than 3% bigger, takes less than 4 seconds. <br />
<br />
Choose wisely <img src="https://www.gimp-forum.net/images/smilies/biggrin.png" alt="Big Grin" title="Big Grin" class="smilie smilie_4" />]]></description>
			<content:encoded><![CDATA[The PNG compression level is that setting in the PNG options that is set by default to 9 and that everyone keeps that way. <br />
<br />
But what is its purpose anyway since the compression is lossless? Once decompressed the image is still the same whatever the setting? So why is it an option?<br />
<br />
It happens that the PNG compression algorithm is quite CPU-intensive so this setting tells the algorithm how hard it should try to find things to compress. Unlike JPEG where you trade file size for image quality, in the PNG format you trade file size for CPU during export, and on big images it makes quite a difference. So lets see what happens with four different images (16Mpix each except the photo which is 14Mpx):<br />
<ul>
<li>A plain text (8 lines in a text layer with a large font), which is expected to compress very well (PNG is designed to be efficient on computer-generate images)<br />
</li>
<li>A Simplex noise which is random but with a large proportion of pure black pixels (about 50%) <br />
</li>
<li>A Plasma noise which is also truly random but is made slightly less random by applying a small median blur to it.<br />
</li>
<li>A photo of a gorgeous French village.<br />
</li></ul>
Each image was exported (without alpha channel) in the 10 levels of compression, measuring the final file size and execution time. Then the results were plotted, using the size relative to the uncompressed version and the relative time to compress:<br />
<br />
<div style="text-align: center;"><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.gimp-forum.net/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=10560" target="_blank" title="">CompositePlot.png</a> (Size: 100.48 KB / Downloads: 1846)
<!-- end: postbit_attachments_attachment --></div>
<br />
For instance, in the Simplex case, the final size with compression is about 20% of the uncompressed size, and for level 7 the export took about 5 times longer than the uncompressed export. <br />
<br />
These curves make it clear that in all cases, some compression is better than no compression at all.  However, past levels 4-5, there is a very substantial increase in compression time for little or no gain on the file size. In absolute numbers, given that the uncompressed export took a good half second, level 9 is nearly 18 seconds for the photo, when level 6, that produces a file which is less than 3% bigger, takes less than 4 seconds. <br />
<br />
Choose wisely <img src="https://www.gimp-forum.net/images/smilies/biggrin.png" alt="Big Grin" title="Big Grin" class="smilie smilie_4" />]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Get back the [Tool Options] in one click]]></title>
			<link>https://www.gimp-forum.net/Thread-Get-back-the-Tool-Options-in-one-click</link>
			<pubDate>Fri, 08 Sep 2023 11:18:15 +0000</pubDate>
			<guid isPermaLink="false">https://www.gimp-forum.net/Thread-Get-back-the-Tool-Options-in-one-click</guid>
			<description><![CDATA[Recently on reddit someone gave a tip in a very simple way to show back the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Tool Options</span>... <br />
Why I never ever thought or tried this, it's something I still don't understand...<br />
<br />
Anyway, there is no need to go to the top menu <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Windows &gt; Dockable Dialogs &gt; Tool Options</span> =&gt; <span style="font-weight: bold;">just double click on the tool you are using in the ToolBox!</span><br />
If the Tool Options dialog is not open or you don’t find it, just <span style="font-weight: bold;">Double click on the tool</span> you’re using to bring it up. The dialog will flashes if it's opened or the dialog will open <span style="font-weight: bold;">and flashes</span>.<br />
Yes as simple as that!<br />
<br />
No need to say that I tried it, I did close the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Tool Options</span>, double click on a tool in the toolbox, and Voilà... the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Tool Options</span> appears on the right side (yeah just need to transfer it to its proper place, anyway if you pass by the top menu it's the same &gt; appears on the right side <img src="https://www.gimp-forum.net/images/smilies/wink.png" alt="Wink" title="Wink" class="smilie smilie_2" /> )]]></description>
			<content:encoded><![CDATA[Recently on reddit someone gave a tip in a very simple way to show back the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Tool Options</span>... <br />
Why I never ever thought or tried this, it's something I still don't understand...<br />
<br />
Anyway, there is no need to go to the top menu <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Windows &gt; Dockable Dialogs &gt; Tool Options</span> =&gt; <span style="font-weight: bold;">just double click on the tool you are using in the ToolBox!</span><br />
If the Tool Options dialog is not open or you don’t find it, just <span style="font-weight: bold;">Double click on the tool</span> you’re using to bring it up. The dialog will flashes if it's opened or the dialog will open <span style="font-weight: bold;">and flashes</span>.<br />
Yes as simple as that!<br />
<br />
No need to say that I tried it, I did close the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Tool Options</span>, double click on a tool in the toolbox, and Voilà... the <span style="padding-left: 1px; padding-right: 1px; font-family:Monospace; font-weight: bold; font-stretch: condensed; filter: contrast(60%);">Tool Options</span> appears on the right side (yeah just need to transfer it to its proper place, anyway if you pass by the top menu it's the same &gt; appears on the right side <img src="https://www.gimp-forum.net/images/smilies/wink.png" alt="Wink" title="Wink" class="smilie smilie_2" /> )]]></content:encoded>
		</item>
	</channel>
</rss>