Commit Graph

9295 Commits

Author SHA1 Message Date
Alx Sa a3fb3ca110 plug-ins: Enable export of original Duotone data
Optionally includes the previously saved 
Duotone color space data on PSD export.
New load dialogue alerts user if duotone data was imported.
New export dialogue appears if the image is still grayscale and
the parasite exists.
If selected, the mode is set to PSD_DUOTONE in the header and
the original duotone data is written in the color space section.
2022-08-19 19:19:20 +00:00
Jehan dfb7d2543a Issue #8505: WEBP, be more informative with error.
Add the info about max dimension of WebP with WEBP_MAX_DIMENSION macro.

There is also a test about (picture->width / 4 > INT_MAX / 4), resp.
height, but this should anyway never happen as the C spec says the
smaller range for int is [-32767, 32767], which is an order bigger than
the current WEBP_MAX_DIMENSION (16383).
So we are probably fine assuming all VP8_ENC_ERROR_BAD_DIMENSION errors
will happen because of WEBP_MAX_DIMENSION.
2022-08-19 14:10:15 +02:00
Alx Sa bf53e420af Issue #1973: Add toggle to choose PNG bit depth behavior 2022-08-17 18:05:13 +00:00
Jehan 31df4c2bf1 Issue #8498: Quirky text to translate in gradients-save-as-css.py.
Just duplicate the blurb into the help string. I'll leave it to someone
else to write a dedicated, longer help text if needed.

Also fixing the call s/Gimp.init/GimpUi.init/.
2022-08-16 21:18:51 +02:00
Jacob Boerema 969b71f78d plug-ins: add support for extra layer mask
According to the specs the extra mask (which they call real user supplied
layer mask) is used "when both a user mask and a vector mask are present".

I haven't seen an example that has the extra mask, so not sure which of
the masks would appear first.

For now assuming that the extra mask will be first. The advantage of
adding this here now, is that we won't try to add a mask channel as a
normal channel.
2022-08-15 14:32:54 -04:00
Alx Sa e28c076622 plug-ins: Use image intent APIs
This updates the JPEG and TIFF CMYK exports to use the image's
simulation rendering intent, rather than always
assuming relative colorimetric
2022-08-14 01:49:56 +00:00
Alx Sa aa51b9e19e plug-ins: Add .ani file import/export 2022-08-08 18:31:45 +00:00
Alx Sa ff1766be08 plug-ins: Fix Color XHTML export and GUI crash
Fixes some syntax and makes the plug-in aware of multi-layer selection,
so that the dialog actually appears when exporting as .html.
2022-08-06 15:10:41 +00:00
lloyd konneker 36521f5db2 Fix so that ScriptFu test scripts are not localized. 2022-08-06 14:37:56 +00:00
lloyd konneker ceddb0d369 Fix #8465 2022-08-06 10:02:17 -04:00
Jacob Boerema 5fbd06629d plug-ins: fix #8411 crash when attempting to open PSD
Apparently some layers in PSD files can have extra channels which we
did not account for when computing destination offsets, causing crashes.

So let's make sure we don't include the "extra" channels when computing
the offsets by introducing base_channels. We also move the alpha channel
in the spot of the first extra channel (even though it seems, based on
the one example we have, that the extra channel might be the same as
the alpha channel).
2022-08-03 18:10:32 -04:00
lloyd konneker 031601a92a Fix 8452, crashing scripts.
Bugs in earlier enhancements re GFile, GEnum.
2022-08-03 15:51:15 -04:00
lloyd konneker 974f694cd2 ScriptFu: scripts use v3 API for multilayer gimp_image_get_selected_drawables etc.
Commit a6aba929 deleted the old functions.

Misc drive-by fixes for gtk_adjustment step not < pages

Issue #8155 discusses alternative fixes, convenience functions for compatibility in ScriptFu.
There is one compat function defined already in ScriptFu, temporarily: gimp-image-get-active-drawable
which was written so that testing clothify-v3.scm could proceed.
2022-08-03 12:48:07 +00:00
lloyd konneker 12c0c18036 ScriptFu: script-fu-register-filter for GimpImageProcedure.
Resolves #8382

Also v2 scripts infer and set sensitivity to drawables

Add two test plugins clothify-v3.scm and test-sphere-v3.scm.
Temporary, to be removed when 3.0 ships.

Some refactoring (extracting methods, moving functions to new files).

Some drive-by fixes to script-fu-arg.c revealed by using GimpProcedureDialog.
2022-08-02 07:45:35 +00:00
Jehan 8feddf9cd5 plug-ins: store a CMYK profile as soft-proof profile in the right place.
Fixing !646. The call to gimp_image_set_simulation_profile() was only
happening for merged PSD mode (either explicit call or when
special-cases such as no layers).

This is the right place to store the CMYK profile in all cases.
2022-07-21 14:34:31 +02:00
Nikc 22986b6912 plug-ins: Use babl to load CMYK .PSD files
Removes gimp_color_transform_process_pixels () calls
when a CMYK profile is present, and uses babl_format_with_space ()
instead for all cases. Additionally, possible errors are now recorded
during the conversion process.
If attached, the image's CMYK profile is stored in GimpImage
afterwards.
2022-07-21 11:47:41 +00:00
Alx Sa 388a5a3b4c plug-ins: Fix crash in histogram-export
As noted by @Ofnuts, histogram-export still expected to receive
a single layer from GIMP. The parameters have been updated to
reflect receiving multiple layers/drawables, and the active layer
is selected. The parameter was left in case multi-layer support
is added in the future.
2022-07-20 12:51:03 +00:00
Jehan 2a85dd08a9 plug-ins: replace gimp_image_get_active_drawable() by newer function…
… gimp_image_get_selected_drawables().
2022-07-19 22:52:06 +02:00
Alx Sa 0f323d0279 plug-ins: Use CMYK profile stored in GimpImage
CMYK profile is now stored in GimpImage on load 
(rather than being discarded) and it's used for export rather than
the default simulation profile stored in Preferences
2022-07-19 19:26:45 +00:00
Jehan 240dc12912 Issue #8385: problem importing SVG containing huge data.
libxml has a XML_PARSE_HUGE parsing option, which can be turned on with
the RSVG_HANDLE_FLAG_UNLIMITED option in librsvg.
We cannot just set this option by default because it is a security
hazard as a maliciously malformed SVG could use this to consume too much
memory.

Instead, let's just propose the option interactively when we fail to
create a rsvg handle. Unfortunately right now we can't single out this
specific error because librsvg actually returns an unrelated (false
positive created by the huge data) error. So we just propose the option
for any kind of handle creation failure.

Furthermore, the option is only available on interactive plug-in calls
so far. In particular, the PDB API doesn't have an option allowing a
script writer to run "file-svg-load" with the huge data option.

As for the thumbnail API, it is never meant to be used interactively and
not really as a common script function, so it won't have the huge data
option either.
2022-07-19 18:29:28 +02:00
Alx Sa 984586f623 plug-ins: Store CMYK profile in image on TIFF load
Now that images can contain their simulation profile,
we can use gimp_image_set_simulation_profile() to retain
the CMYK profile when a TIFF image is loaded.
It will then be accessible in GIMP's Image menu.
2022-07-17 17:12:45 +00:00
Jehan 12c7501552 plug-ins: fix small memory leak from MR !627. 2022-07-17 19:08:37 +02:00
Nikc 714b74568b plugins: fix #356 Add export option for CMYK TIFFs
Adds support for saving 8 and 16 BIT CMYK/A TIFF files using the
image's simulation profile. If no profile or a non-CMYK profile
is set for the simulation profile, naive conversion is used instead.
2022-07-17 16:09:22 +00:00
Niels De Graef 526a28de3f plug-ins: Make sure we initalize GimpVector4
This fixes a warning about the variable being used uninitialized.
2022-07-08 09:50:25 +02:00
Jehan 32501f502b plug-ins: fix generated common plug-in files and file-wbmp localization.
The Makefile.am was apparently updated by hand in !662.

Also fixing plug-in label and doc localization, since this changed
recently and must now be localized directly on plug-in side.
2022-07-07 21:27:39 +02:00
ktoyle d1fac7bfa9 plug-ins: Create wbmp plug-in
Added plug-in that would let the Gimp program to read WBPM image files.

See #2508 and !662.
2022-07-07 19:23:35 +00:00
Jehan ca1a0e3650 plug-ins: gimp-plug-in-domain-register PDB procedure doesn't exist…
… any longer.

It's not deprecated in favor of a new name, it just doesn't exist as it
was removed in commit 81b569cb8c.
2022-07-06 16:14:03 +02:00
lloyd konneker c2b13d6f91 ScriptFu: register args with proper GParamSpecs
Resolves #8328

Except existing GimpParamSpecs seem inadequate to specify less generic widget kinds.
2022-07-05 19:17:52 +00:00
Jehan df074bfe09 plug-ins: label and documentation of plug-ins localized plug-in side.
This is the consequence of previous commit. Plug-ins' label and
documentation are now localized before sending these data to GIMP core.
In other words, we replace N_() macros with basic gettext calls.
2022-07-05 12:23:51 +02:00
lloyd konneker fadae20618 ScriptFu: Extract informal class SFArg from script-fu-script.c
Why: puts most methods for SFArg (a struct) in one place, for ease of maintenance.
Prepares to fix issue 8328.  Prepares to make SF use GimpProcedureDialog.

Mostly moving code, with no intended change in functionality,
except fixed an property.nick for an arg is now what a script author provided,
instead of generated.

All internal to libscriptfu.  No changes to the exported API or to i18n.

Lightly tested, since more substantive changes coming for issue 8328.
ScriptFu>Test>Sphere is the test case.
2022-07-04 08:28:19 +00:00
lloyd konneker ea81ae747d ScriptFu: delete unneeded #define G_LOG_DOMAIN
It clutters the compile log.
Compile flag -DG_LOG_DOMAIN="scriptfu" now does this.
2022-06-30 13:44:07 -04:00
lloyd konneker d5a83429b4 ScriptFu: Add script-fu-interpreter akin to other interpreters
Why:
1) users can install .scm scripts to plug-ins dir
2) Crashing scripts do not crash extension-script-fu

Scripts (.scm files) have a shebang and are executable
and in a same-named subdir of plugin dir.

Interpreter/scripts create PDB procs of type PLUGIN unlike extension-script-fu
which creates PDB procs of type TEMPORARY, owned by extension-script-fu.

Unlike other interpreters, the interpreter is-a plugin outright,
not by virtue of the script subclassing GimpPlugin and using GI.

More details in /plug-ins/script-fu/interpreter/README
2022-06-30 13:39:45 +00:00
Jehan 69f6f5748a plug-ins: use list() variants in bindings.
Cf. previous commit.
2022-06-27 22:30:42 +02:00
Jehan e3cc34fc6d plug-ins: add "planar-configuration" argument to "file-raw-load".
Instead of having a single "Planar RGB" format in the list, let's add
this as a generic parameter. Not only does it make the feature
symmetrical to "file-raw-save", but it also bring the ability to all
multi-channel formats. So now, we can load RGB, RGBA, GRAYA, whatever
the bit depth and the data type stored in planar configuration.
2022-06-22 22:25:18 +02:00
Jehan 559d686d07 plug-ins: break "pixel-format" arg with 2 new args: "data-type" and…
… "endianness".

The list of formats being a single list was actually interesting
UI-wise, in the case where you aren't sure of the data layout (but say
you know at least the dimensions), you can easily and quickly scroll
through the combo list (e.g. with keyboard arrows).

But when you knew your data, it was a pain to use. And as a general
rule, so many choices in a list is not the best interface.

I broke the option into 3 options, and in particular adding a
"data-type" which would tell what type of values are stored (integer,
signed or unsigned, or float) and an "endianness" to tell the byte
order. The idea behind is that these don't change the layout of
components and their size. It means that we can still do the
scrolling-randomly-through-formats trick in some fashion because we
might likely be able to detect shapes when we get at the right layout,
even though we are still set to use the wrong data type and/or the wrong
endianness.
2022-06-22 20:09:10 +02:00
Jehan 657d37a8fe plug-ins: adding RGBA and grayscale float variants + grayscale-alpha…
… loading support as raw data.

Barely any new code (and actually a bit chunk of removed code) as we are
using generic code paths now.

"file-raw-load" procedure now supports all possible formats which can be
exported by the "file-raw-save" procedure (and more).

Only thing remaining now is looking how to simplify the GUI because this
overlong Pixel format combo box is quite a pain.
2022-06-22 19:05:34 +02:00
Jehan e3c7791acc plug-ins: adding support for RGB 16 and 32-bit float raw data.
Since we can now export these, let's add import support.

I copied the function halfp2singles() from babl code (as-is, without
formatting according to our coding style on purpose as we might just
want to switch this again later on).
2022-06-21 19:07:17 +02:00
Jehan 2ffb7c12d1 plug-ins: now adding support for 16 and 32-bit RGBA raw data.
Quite easy now that we have generic code paths.
2022-06-21 01:49:09 +02:00
Jehan b953acd2b9 plug-ins: add support for RGB 16 and 32-bit raw data.
I add the Little and Big Endian variants, but not the signed one for
now, because I am unsure how common it is. We have signed grayscale
variants, but it might be specific use cases there.

While adding these new loading support, I factorize the code when
possible by making all full-bytes RGB/Grayscale code more generic and
using the same code paths. In particular, raw_load_gray_8_plus() is now
removed as raw_load_standard() will handle all full-bytes use cases
where the input and output formats have the same components in same
order.

Also RAW_RGB and RAW_RGBA are renamed to RAW_RGB_8BPP and RAW_RGBA_8BPP
respectively.
2022-06-21 01:37:39 +02:00
Jehan 55790d7bb2 plug-ins: support more cases of grayscale raw data.
- rename raw_load_gray16() into raw_load_gray_8_plus() and make it
  handle all full-byte grayscale data. Move 8-bit grayscale data to use
  this function as well.
- As a consequence of the previous point, we can also easily support
  32-bit grayscale images (little/big endian, signed/unsigned).
- Make preview image code more generic as well.

Also I improve a bit code from previous commit in raw_load_rgb565(). The
allocated and read code didn't need to be the size of the full line
stride. Just the tile rectangle width was enough.
2022-06-20 21:53:19 +02:00
Jehan ba582253df plug-ins: raw_load_rgb565() ported to GEGL iterators.
Rather than allocating 2 huge data buffers of the whole image size (one
in RGB565 and one in RGB-u8), just iterate through the file only
creating one single small temporary data buffer for single input line in
tiles returned by the iterator. This will be much better,
memory-efficiency wise.
2022-06-20 14:39:09 +02:00
Jehan e9876a8b7f plug-ins: rename "color-representation" to "pixel-format".
This initial name was really ugly. I think talking of pixel format or
color format is much more common, at least around GIMP codebase.
2022-06-20 14:39:09 +02:00
lloyd konneker 07ceb5a086 ScriptFu: extract PDB proc script-fu-server from plugin script-fu
Create new plugin file script-fu-server-plugin.c
with code extracted from script-fu.c, which is an omnibus plugin
implementing PDB proc extension-script-fu and other PDB procs.

Why:

1. extension-script-fu is smaller and doesn't doesn't link to socket libraries.
   (GIMP always starts extension-script-fu and it stays running.)

2. packagers/admins can omit script-fu-server executable from an installation,
   if they think letting users serve net ports is not secure.

3. crashing script-fu-server does not crash extension-script-fu,
   which requires restart of GIMP

The changes are mostly a simple refactor, extracting code.
No functional change apparent to users.
Low risk of introduced bugs.
Extremely few users use script-fu-server anyway.
Added some logging.
While at it, use G_DECLARE_FINAL_TYPE
2022-06-19 19:18:39 +00:00
Jehan 4e3edb5121 plug-ins: fix some warnings.
Should have paid more attention. I left 2 warnings in the file:

> plug-ins/common/file-raw-data.c:1949:22: warning: variable ‘procedure’ set but not used [-Wunused-but-set-variable]

> plug-ins/common/file-raw-data.c:1970:48: warning: ‘bpp’ may be used uninitialized in this function [-Wmaybe-uninitialized]
2022-06-19 20:26:45 +02:00
Jehan a554349e52 plug-ins: dynamically lower width/height with impossible values.
Even though the scale entries have maximum values based on the file
size, it's still too big for many formats (multi-byte ones) when
thinking in terms of pixels.

Moreover if growing the offset or any dimension, comes a point where the
other dimension needs to shrink. So let's compute max pixels and update
other values depending on this.

Note that it's still quite easy to crash the dialog with big dimensions,
triggering X Window System errors about unsufficient resources in
GimpPreviewArea code. This will have to be handled accordingly.
2022-06-19 01:17:39 +02:00
Jehan 5b22cef644 plug-ins: do not unref anymore int stores given to…
… gimp_procedure_dialog_get_int_combo().

See previous commit.
2022-06-17 17:59:54 +02:00
Jehan 38f0535847 plug-ins: port file-raw load procedure to GimpProcedureDialog API.
- Add various relevant arguments to "file-raw-load" PDB call: width,
  height, offset, color-representation, palette-offset palette-type and
  palette-file. This will make the procedure actually usable for
  scripts.
- Use procedure config so that we get configuration storage as all other
  ported plug-ins.
- Update the source to use passed-in config object with these new
  arguments rather than global variables.
- The load dialog now uses the GimpProcedureDialog which means a lot
  simpler and nicer to read/debug code (we don't need all the code for
  argument syncing).

- "file-hgt-load" code now uses a HgtSampleSpacing enum, which makes
  code nicer to read, with semantic constant names.
- Do not show the dialog anymore for HGT load when sample spacing
  detection worked correctly. Indeed, offset and profile selection were
  making sense for random raw data, not for HGT file which we know how
  to process.
- Improve detection logic for sample spacing: in interactive mode, we
  always try and detect and show the dialog when spacing detection
  failed; in non-interactive mode, we only detect when "sample-spacing"
  argument is explicitly set to HGT_SRTM_AUTO_DETECT.

- The argument "image-type" of "file-raw-save" PDB call is renamed to
  "planar-configuration" to sync with the natural language label. Also
  it now uses a separate RawPlanarConfiguration enum rather than using
  specific values of the RawType enum (which made that the possible
  values were 0 or 6, which was a weird API in GIMP 2.10).

The plug-in still cannot load all possibly exportable formats (after
commit 01e0675f67) and I'm still wondering about whether
"color-representation" argument in the load call should not be broken
down into several arguments (it has both advantages and disadvantages).
This will be handled in further commits. For this first step, I needed
to clean the load code.
2022-06-17 17:18:12 +02:00
Daniel Novomeský 7452c4bc6e plug-ins: ensure that metadata correspond to real image size 2022-06-16 16:46:31 +02:00
Jehan 73868afe15 plug-ins: fix script-fu build in meson.
Fixes:

> plug-ins/script-fu/meson.build:44:0: ERROR: Bad source of type 'SharedLibrary' in target 'script-fu'.
2022-06-15 21:18:37 +02:00
Jehan 319ccb1d81 Issue #7091: Exporting 16-bit precision images to raw *.data.
Another part for the fix: now that it is possible to export any of the
color model and bit depth supported by GIMP core, we should make the
dialog settings clearer. In particular, don't just always show "RGB"
structure sample.

If an alpha channel is present, also show RGBA samples, and if it's a
grayscale image, show "Y" or "YA" samples. Actually when it's a
non-alpha grayscale, just make the option insensitive as planar and
contiguous will be the same thing.
2022-06-15 21:18:37 +02:00