MarcusCemes/image-processing-pipeline

Can't manage to write a correct config file

Closed this issue ยท 5 comments

Hi,

I've just found your repo today and it looks like it's exactly what I was looking for.

Unfortunately, as I'm not very comfortable with JS (and doesn't know anything about TS), I didn't manage to write a correct config file to override the default exportPresets.

I only need to add some breakpoints and change the names of the presets.
I'm using the CLI tool.
What would be a correct js or json config file for this ?

And can I simply remove the max height key to only resize based on the images width ?

Thanks in advance.
Best regards

Hi willdante,

The script will pick up any of the valid config file names. If you're launching in CLI mode from the terminal, having a .ribrc.json file in your current working directory (or in theory, any parent directories) will allow you to override config options. No JS or TS required. There's an example below.

Omitting the height property will pass undefined to sharp, which from their documentation will have the desired effect. Good luck!

.ribrc.json

{
  "in": "./ingest",
  "out": "./assets",
  "exportPresets": [
    {
      "name": "thumbnail",
      "height": 16,
      "width": 16,
      "force": true
    },
    {
      "name": "small",
      "width": 1280,
      "force": true
    }
  ]
}

Thanks a lot!

I managed to make it work with some adjustments in .ribrc.json:

  • width and height expect a string, so "width": 1280 should be "width": "1280" for example
  • height is required so I added "height": "auto" instead of removing the line to have the desired effect

Now I have another question, I'm using the width value as name for my presets but the default ones (small, normal, etc) are still exported.

How can I disable these default presets without using the same names ?

๐ŸŽ‰ This issue has been resolved in version 3.1.3 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

I have no idea how those two issues escaped me.

As of v3.1.3, width and height should now expect numbers (and not strings) and are now optional, and providing new presets will now also override the default ones by correctly merging the user's configuration.

Have a great day!

Wow, that's great news, thanks !