Page 1 of 1

[2.0.76] icon from dump-icon-sprites icon is offset and cropped

Posted: Mon May 18, 2026 10:32 am
by harpocrates
Repro:
  1. install https://mods.factorio.com/mod/TFMG version 2.0
  2. factorio --dump-icon-sprites and factorio --dump-data
  3. in the script output folder, the .../factorio/script-output/recipe/organic-carbon-liquefaction.png looks cropped and offset compared to in-game (see in-game screenshot vs. attached organic-carbon-liquefaction.png)

This happens reliably.

My understanding is that the --dump-icon-sprites command is supposed to fully handle flattening, offsetting, etc. layers and icons so that you just an icon that looks like what you see in-game. I see in the --dump-data output that recipe.organic-carbon-liquefaction indeed has some more icon layers that scale and shift:

Code: Select all

{
  // ...
  "recipe": {
    // ...
    "organic-carbon-liquefaction": 
    {
    "type": "recipe",
      "category": "chemistry-plant",
      "subgroup": "fluid-recipes",
      "name": "organic-carbon-liquefaction",
      "icons": 
      [
        
        {
          "icon": "__base__/graphics/icons/solid-fuel.png",
          "tint": 
          [
            0.5,
            1,
            0.5
          ]
        },
        
        {
          "icon": "__base__/graphics/icons/fluid/lubricant.png",
          "shift": 
          [
            -10,
            0
          ],
          "scale": 0.7
        }
      ],
      // ...
    },
    // ...
  }
  // ...
}

Re: [2.0.76] icon from dump-icon-sprites icon is offset and cropped

Posted: Mon May 18, 2026 4:19 pm
by Rseding91
Looking into this: the dump version is actually more-correct than what you see in the GUI. You've asked for the solid-fuel sprite to be drawn at the center, then draw the lubricant icon at 70% scale 10 pixels to the left of center. That's exactly what you see in the dump version.

The GUI version has shifted the solid-fuel icon to the right by some amount of pixels to account for the off-screen lubricant icon rendering in an attempt to center *the entire set of rendered icons* within the GUI area it was told to render them.

You can observe this in game:
05-18-2026, 12-15-04.png
05-18-2026, 12-15-04.png (190.96 KiB) Viewed 190 times
notice how the icon(s) are not centered on the machine.

What I believe the icon definition should be:

* Shift the solid fuel to the right by 5 pixels
* Scale the solid fuel down by 30%~
* Lower the lubricant shift from 10 to 5 pixels
* Scale the lubricant down by an additional 30%~

Roughly that would cause what you see in GUIs to be what you see in recipe alt mode.

Perhaps someone will rework the dump icons logic to try to handle this case but for now I'm simply going to leave this in bug reports.

Re: [2.0.76] icon from dump-icon-sprites icon is offset and cropped

Posted: Mon May 18, 2026 4:30 pm
by Bilka
This rendering being different in GUIs and in the game world is expected behaviour:
https://lua-api.factorio.com/latest/types/IconData.html wrote:The final icon will always be resized and centered in GUI so that all its layers (except the floating ones) fit the target slot, but won't be resized when displayed on machines in alt-mode. For example: recipe first icon layer is size 128, scale 1, the icon group will be displayed at resolution /4 to fit the 32px GUI boxes, but will be displayed 4 times as large on buildings.
Since the rendering on the machine is the more exact replication of what the prototype defines, I am comfortable considering this not a bug - the dump can't/won't render multiple versions of the same icon to account for these in-game rendering differences.