[gimp-web] content: now the news is complete and ready for final reviews!



commit 201f2f94dc712055513f9dd79e745b536ec0d76a
Author: Jehan <jehan girinstud io>
Date:   Fri Aug 26 22:10:56 2022 +0200

    content: now the news is complete and ready for final reviews!

 .../2022/2022-08_GIMP-2.99.12_Released/index.md    | 124 +++++++++++++++++++--
 1 file changed, 115 insertions(+), 9 deletions(-)
---
diff --git a/content/news/2022/2022-08_GIMP-2.99.12_Released/index.md 
b/content/news/2022/2022-08_GIMP-2.99.12_Released/index.md
index 2960a4c5..2ca748fc 100644
--- a/content/news/2022/2022-08_GIMP-2.99.12_Released/index.md
+++ b/content/news/2022/2022-08_GIMP-2.99.12_Released/index.md
@@ -254,7 +254,24 @@ as we progress towards GIMP 3.0.
 
 ### Customizable checkerboard colors
 
-TODO
+In GIMP, we represent transparency in an image through the very common
+"checkerboard" pattern. In order to handle various use cases, we were
+proposing a series of colors, from light to dark grays, and even
+proposing white, gray or black only backgrounds. Though all these had
+the shared characteristics of being shades of gray.
+
+`Preferences > Display > Transparency > Check style` has now a new
+option "*Custom checks*" allowing to select any RGB colors for the 2
+colors representing "transparency". If you wish to show transparency
+with rainbow 🌈 colors, this is up to you!
+
+The new function `gimp_checks_get_colors()` has been added to the
+interface for plug-ins, replacing `gimp_checks_get_shades()`. This would
+allow any plug-in needed to render transparency checkerboard according
+to user choice.
+
+This was originally contributed by Ben Rogalski, then improved, in
+particular for proper API and plug-in support.
 
 ### Welcome Dialog
 
@@ -407,7 +424,7 @@ The updated formats so far are:
    * CMYK import ported to GEGL/babl conversion. The CMYK profile in
      the PSD image will be stored as soft-proof profile on the image.
 
-### NEW plug-in API
+### New plug-in API
 
 Plug-ins can now request or set the soft-proofing profile of an image
 with new functions, such as `gimp_image_get_simulation_profile()` or
@@ -704,13 +721,13 @@ specific lists of options.
 
 ## API
 
-The Application Programming Interface for plug-in developer has known
+The Application Programming Interface for plug-in developer received
 various improvements and changes within this iteration.
 
 Of course, we have many new functions corresponding to new features in
 GIMP, such as for the simulation color management, customizable
-checkerboard colors and more. [See the list for
-more](https://gitlab.gnome.org/GNOME/gimp/-/blob/50a1fd6ed33a8e20636d176b5f36064a4df15a08/NEWS#L280).
+checkerboard colors and more. [See the
+list](https://gitlab.gnome.org/GNOME/gimp/-/blob/50a1fd6ed33a8e20636d176b5f36064a4df15a08/NEWS#L280).
 
 A new `gimp_image_metadata_save_filter()` also appears, as an
 alternative to `gimp_image_metadata_save_finish()` when you want to save
@@ -726,13 +743,102 @@ in GIMP 3.0, with [multi-item
 selection](https://www.gimp.org/news/2020/11/06/gimp-2-99-2-released/#multi-layer-selection).
 
 Among the many other changes, one of the most important changes in this
-updated API is how we handle plug-in localization.
-
-TODO
+updated API is how we handle plug-in localization. While the translation
+of most strings were left to the plug-in's discretion, the strings at
+register time (plug-in title, documentation…) were translated by the
+core, e.g. when used in menus of in the PDB browser, using gettext
+catalog given at registration time. This raised various issues, such as
+what happens if several plug-ins were to register a catalog with the
+same name (which could have been fixed, with even more complicated
+internal logic). Or what happens if a plug-in doesn't register a
+localization catalog, but the default catalog contains (wrong)
+translations for submitted strings? Moreover it ended up to be quite
+confusing as many plug-in developers were wondering what is translated
+where, i.e. if a string should be surrounded by `_()` (common gettext
+macro) or `N_()` (noop gettext macro).
+
+So the new logic is much simpler: translation is now left completely at
+the plug-in discretion, i.e. all strings received by the core are
+assumed to be in the correct target language. The core doesn't try to
+translate anything coming from plug-ins anymore.
+
+Now to help a bit with localization, our infrastructure proposes a
+standard file organization, with all gettext catalogs under the
+`locale/` folder of the plug-in directory, and named the same way as the
+plug-in itself. If the catalog is absent, our system outputs a message
+on `stderr` to propose this standard procedure. A plug-in following this
+procedure won't have anything else to do than place the compiled gettext
+catalogs (`*.mo` files) with the right domain name in the right folder.
+
+A `GimpPlugIn` can supplant this behavior at any time by overriding the
+`set_i18n()` method, to either disable localization altogether, pointing
+to a different catalog path and name or even use another system than
+gettext.
+
+The only remnant of the old logic, which we need to think about and
+improve, is the localization of menu paths, as we still want
+core-localization of some base menu paths. E.g. the root menus ("Edit",
+"Image", "Colors", "Filters"…) but also some submenus ("Blur",
+"Enhance", "Distorts"…) should still be localized by the core while
+plug-ins will need to handle new parts in the menu path. This is the
+only exception to the new "no core translation" logic for plug-in.
 
 ## Batch processing
 
-TODO
+A new `libgimp` class `GimpBatchProcedure` was added, facilitating the
+creation of batch interpreter plug-ins, i.e. plug-ins meant to be run
+from command line to process a series of procedure calls. Currently 2
+such interpreters exist in GIMP: the Script-fu
+(`plug-in-script-fu-eval`) and the Python (`python-fu-eval`)
+interpreters.
+
+Running code this way is done with the `--batch` <abbr title="Command
+Line Interface">CLI</abbr> option. Historically Script-fu was used as
+default, but this is not the case anymore. Now you must explicitly
+specify an interpreter with `--batch-interpreter`.
+
+Moreover a new option `--quit` was created and this is what you must use
+if you wish to exit GIMP immediately after the scripts are run. Do not
+call `"(gimp-quit 1)"` anymore. A nice improvement is that GIMP will now
+exit immediately after a batch failure (i.e. if you had a series of
+`--batch` calls, it will stop at the first failure) and will propagate
+the failure into the process exit code.
+Exit codes are inspired from command Linux error codes: 0 for success,
+69 for service unavailable (e.g. setting a non-existing interpreter
+name), 64 for usage (e.g. not specifying any interpreter or calling
+errors), 70 for execution errors (bugs in the interpreter plug-in) and
+130 for canceling the call. Therefore you will now know when your
+scripts fail.
+
+As an example of batch processing, here is how you could load a PNG
+image, then export it back as JPEG:
+
+```sh
+$ gimp-2.99 --batch-interpreter python-fu-eval -idf -b 
"img=Gimp.list_images()[0];layers=img.list_layers();c=Gimp.get_pdb().lookup_procedure('file-jpeg-save').create_config();c.set_property('image',img);c.set_property('file',Gio.file_new_for_path('/home/jehan/out.jpg'));c.set_property('drawables',Gimp.ObjectArray.new(Gimp.Drawable,
 layers, 
False));c.set_property('num-drawables',len(layers));Gimp.get_pdb().run_procedure_config('file-jpeg-save',c)" 
--quit  /home/jehan/in.png
+```
+
+This long command line may seem frightening, but this is the same script
+in a file, named for instance `gimp-script.py`:
+
+```py
+img = Gimp.list_images()[0]
+layers = img.list_layers()
+c = Gimp.get_pdb().lookup_procedure('file-jpeg-save').create_config()
+c.set_property('image', img)
+c.set_property('file', Gio.file_new_for_path('/home/jehan/out.jpg'))
+c.set_property('drawables', Gimp.ObjectArray.new(Gimp.Drawable, layers, False))
+c.set_property('num-drawables', len(layers))
+Gimp.get_pdb().run_procedure_config('file-jpeg-save', c)
+```
+
+Run it through GIMP in batch mode like this:
+
+```sh
+gimp-2.99 --batch-interpreter python-fu-eval -idf -b - --quit  /home/jehan/in.png < gimp-script.py
+```
+
+Of course, you can add in your scripts any filtering or image
+manipulation, through GEGL or libgimp API.
 
 ## Build and documentation
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]