Commit Graph

8972 Commits

Author SHA1 Message Date
William Ferguson 636eb02edc plug-ins: update darktable lua script to API change in darktable master
The Lua API is undergoing changes in darktable master. I've fixed the lua-scripts repository as I've made
changes, but I forgot about the collateral damage.

Attached is a fixed version of file-darktable-export-on-exit.lua which should be good for darktable 3.6 and
beyond.

Fixes #6421
2021-02-15 17:11:32 +00:00
Jehan 6b281e8f00 plug-ins: add progression to PDF exporting.
PDF exporting had no progression. In particular when exporting a PDF
with more a hundred pages today, it took maybe 20 secs without any
progression status, which is annoying.

Limitations:
1. When exporting as multi-images, we reset to 0 at each image. I am
   actually not sure if this is the expected behavior.
2. I am updating the progression per top layer, not doing finer grained
   progression steps. An extreme case would be a single top layer group
   with many children layers inside. Yet I wanted to avoid too much
   progression updates for the normal cases.
2021-02-15 00:03:03 +01:00
Jacob Boerema d8009a000b plug-ins: Remove gamma parameter in openraster call to file-png-save.
Commit d57eafd189 removed the
gamma parameter for file-png-save so we have to remove it here too.
2021-01-30 13:18:50 -05:00
Jehan 63d6d770c4 plug-ins: replace gimp_parasite_data*() with gimp_parasite_get_data().
Similarly to the previous commit, it is not only about using the new
API. I also make sure we do not assume that parasite data is
nul-terminated. In many places, we were just assuming so because these
were supposed to be parasite our code set. Yet these are data input
contained in files which can be wrong for any reason (corrupted file,
bugs, other scripts/plug-ins editing these parasites…). So instead of
assuming string parasites are always correctly formatted, I make sure
they are nul-terminated by passing them through g_strndup() when
necessary.
2021-01-30 00:20:34 +01:00
Jehan d57eafd189 plug-ins: gAMA chunk export is now a redundant option.
Now when a gAMA chunk is set on an imported PNG (and if there is no
profile attached), an equivalent profile is created out of the gAMA
chunk. So the displayed image looks like it is supposed to.
On export, the generated profile should simply be saved together in the
PNG file. If not, the sRGB chunk is set anyway (and also an equivalent
gAMA/cHRM as recommended in the specs).

So basically we now have a proper support of the gAMA chunk, from import
to export, and display within GIMP takes this metadata into account
appropriately (in the shape of a generated equivalent profile).
Therefore it looks to me keeping the option is redundant. It is even
confusing (because it's actually hard to understand exactly what this
data is about, even our documentation about this metadata seems to be
wrong) hence possibly dangerous if someone thinks it is important,
checks the box, which would override other data or simply create
irrelevant or contradictory metadata.

So let's just remove this option. Development releases are the right
places anyway for people to notice this change and come to us if we
missed some usage regarding this option.
See also #5363.
2021-01-29 20:06:03 +01:00
Jacob Boerema 4686363606 plug-ins: disable progress updates in file-png in non interactive mode.
The openraster plug-in uses the png plug-in in non interactive mode
to load and save layers. With a lot of layers we get a lot of
flashing popups because of the progress dialogs.

When it is called in non interactive mode there should not
be a need for progress dialogs so let's disable them in
that case.
2021-01-27 19:07:52 -05:00
Jacob Boerema d87cd48f02 plug-ins: check for run_procedure SUCCESS in openraster
The Openraster plug-in calls file-png-load and
gimp-file-load-layer but didn't check if the result
was SUCCESS. Even though I haven't seen any
failures let's improve error checking by adding
a check for a correct result.
2021-01-27 19:07:51 -05:00
Jacob Boerema 9a19cf3b81 plug-ins: add missing parameters to file-png-save in openraster save_ora 2021-01-27 19:07:51 -05:00
Jacob Boerema 9d9f6e6240 plug-ins: add progress updates to openraster load and save.
Since openraster load and save is not very fast for multi layer
images it seems like a good idea to add progress update
support.
2021-01-27 19:07:51 -05:00
Jacob Boerema 6d6b7e90c2 plug-ins: improve exporting of layer modes for openraster.
The current openraster specification only has a limited
number of layer modes. Let's improve things a little bit
by mapping both the current and legacy layer modes
to the same openraster composite-op where available.

For the other layer modes we could examine what the
closest composite-op is, or add a GIMP specific op
(which is what Krita seems to do). For now we set
all these to the openraster equivalent of NORMAL.
2021-01-27 19:07:51 -05:00
Jacob Boerema 304c7d6bc8 plug-ins: don't use the legacy layer modes in openraster load/save
Let's use the non legacy layer modes when importing/exporting
openraster images. That way we are more likely to be able to
import the correct layer modes since openraster only has a
limited number of layer modes defined.
2021-01-27 19:07:51 -05:00
Jacob Boerema 7650767ad3 plug-ins: loading and saving of group layers failed in openraster plug-in. 2021-01-27 19:07:51 -05:00
Jacob Boerema d001e4b38b Issue #5984 file-openraster-save throws CRITICAL at Gimp.ObjectArray.new() 2021-01-27 19:07:51 -05:00
Stanislav Grinkov 926eb43716 plug-ins: #5896. add option for reversing order of layers when importing PDF
This feature adds new 'Load in reverse order' toggle box to allow
selection of order of PDF pages before importing them as a layers or
images.

Adds new bool parameter 'reverse-order' to Non-interactive mode.
Order of parameters was also changed from (password, n-pages, pages)
to (password, reverse-order, n-pages, pages)
2021-01-22 10:44:06 +00:00
Stanislav Grinkov a55cab8f80 plugins: feature #449 allow fract DPI values when importing PDF
This commit fixes the issue when requested page width/height was
not honored because DPI resolution value was constrained to whole
integer numbers only.
2021-01-18 19:27:08 +00:00
Jehan d21911ebfc Issue #3265: PNG gAMA chunk is silently ignored.
PNG has support for profiles, which is the state-of-the-art way to
handle color management nowadays. But it also had some very basic color
management based on a gAMA chunk (for the gamma) and a cHRM chunk
(primary chromaticities).
We don't have a core concept with just these and don't want to walk
backward anyway, but we can easily make basic RGB profiles from these.
This is what this commit is about. It generates profiles at import which
were not actually inside the image, but only represented by these 2 PNG
chunks. What gives it away is that GIMP will propose to convert/keep the
profile at start (unless configured otherwise, as any profile), and the
profile name will specify it is a profile generated from PNG chunks'
values.  One can even discard the profile later (if you didn't convert),
so it gives a solution if somehow these metadata were not proper.
2021-01-18 16:16:56 +01:00
Jehan 7465b0782a plug-ins: more debugging data in file-darktable.
darktable GUI is "mangled" when opened from GIMP for a reporter. There
was already some debug info outputted (when running with DARKTABLE_DEBUG
environment variable). Adding the environment list (and some separation
titles to make it easier to distinguish what is what). Hopefully it will
help debugging.
See #6195 and https://github.com/darktable-org/darktable/issues/7402
2021-01-18 14:37:02 +01:00
Daniel Novomesky 6ca6a8d239 HEIF plug-in: ensure max quality for lossless encoding
There is a possible bug in libheif. Lossless setting is not working
when AVIF is saved via rav1e encoder.
This is a workaround of the problem.
2021-01-18 10:54:09 +00:00
Jacob Boerema 83ab86eb8b plug-ins: fix #6279 Error loading PSD file: Unexpected end of file.
We were not handling all possible record sizes for mask info and
in case it was an unknown size we set everything to 0 instead
of reading the parts we do recognize.

Let's make it more flexible by reading the parts we do know
about and skip the remaining data if any.

Also added a few more g_debug statements to make it
easier to check some values when needed.
2021-01-17 16:08:01 -05:00
Jehan 823ae50cc5 plug-ins: fix crash at end of JPEG export.
Not sure why we didn't see the crash earlier and it suddenly shows up
now. Anyway we must delete the exported image **after** calling
gimp_procedure_config_end_export() on it, obviously.
2021-01-17 21:53:48 +01:00
Jehan 07a3734db5 plug-ins: fix plugin-defs for file-heif.
Commit 01e1587ec1 had directly edited the Makefile.am, which was wrong.
This file is generated by plugin-defs.pl. Add the proper dependencies
for file-heif and regenerate the Makefile.am.
2021-01-17 20:32:23 +01:00
Jehan f77e261cd4 plug-ins: export with explicit PNG's sRGB chunk when no profile written.
When a profile is set, we should not set the sRGB chunk, because it
would be a contradiction. But when we don't set the profile, then our
code explicitly saves as sRGB. So let's add the sRGB chunk.

Also when we do so, let's also set the relevant gAMA and cHRM chunks
corresponding to sRGB as recommended by the PNG spec:

> An application that writes the sRGB chunk should also write a gAMA
> chunk (and perhaps a cHRM chunk) for compatibility with applications
> that do not use the sRGB chunk. In this situation, only the following
> values may be used: […]

This is why I use png_set_sRGB_gAMA_and_cHRM() and not just
png_set_sRGB().
See also discussions in #5363.
2021-01-17 00:25:11 +01:00
Jacob Boerema f489976b05 plug-ins: fix #5081 Opening TIFF with YCbCr format displays incorrect warning.
When testing for the presence of extra channels we were not taking into
account all values of TIFFTAG_PHOTOMETRIC causing incorrect messages
that we had a non conformant TIFF without ExtraSamples field.

Since the same test is used twice I separated the code into a new function
and also added another related function to have similar code grouped
together for easier maintenance.
2021-01-14 12:38:51 -05:00
Jacob Boerema e55e078245 plug-ins: allow loading of BMP images with incorrect BI_BITFIELDS compression.
GIMP was exporting certain BMP images with 1, 4, 8 and 24 bpp
with an incorrectly set value of BI_BITFIELDS for compression,
see issue #6144.

According to the specification this is not supported but testing
shows that many image viewers and editors load these
images correctly.
Since allowing these unsupported values for bpp does not
seem to have any negative side effects and is easy to
implement let's add this.
2021-01-07 18:02:06 -05:00
Jacob Boerema d8c164ced3 plug-ins: fix #6144 Unrecognised or invalid BMP compression format.
The Microsoft specification for BITMAPV5HEADER says that
BI_BITFIELDS is valid for 16 and 32-bits per pixel, but we
were also using this flag for other values of bpp when
no rle compression was used.
Since this specification doesn't mention 24 bpp or other
values use BI_RGB instead.
2021-01-07 18:02:06 -05:00
Jacob Boerema c7efae0cff plug-ins: fix tiff comment getting saved when save comment is unchecked. 2021-01-06 22:55:24 -05:00
Jacob Boerema f814ae7205 plug-ins: save comment on all tiff pages/layers.
Since pages in tiff images can be considered independent
we should also save the comment on each of them.
2021-01-06 17:21:15 -05:00
Shaylin Chetty 2dd61d4613 Fixed #6109 for saving color profile on each tiff layer 2021-01-06 18:08:07 +00:00
Jacob Boerema 691548579a plug-ins: set blue channel of BC5 dds images to 0 instead of 255.
Information in issue #6200 revealed that 0 as default value for
the blue channel is a lot more common than 255 so let's use 
that instead. The discussion and testing revealed no negative
effects for the other formats that use the same code to
initialize the memory to read blocks of image data.
2021-01-05 17:58:20 -05:00
Jacob Boerema a4cc8b7070 plug-ins: fix incorrect dds BC5 images saved by GIMP.
Since older versions of our GIMP dds file exporter incorrectly
saved BC5 dds images with the red and green channels
swapped we should fix that. Since the exporter already
wrote the plug-ins version number and that it is written by
GIMP we can check for these incorrect images.

To enable that we increase the plug-ins revision in this
commit and swap red and green channels for images
that have an older version number and are of the
correct type.
2021-01-05 17:58:20 -05:00
Jacob Boerema efa899ad15 plug-ins: fix #6200 DDS BC5 compression/decompression has Red and Blue swapped. 2021-01-05 17:58:20 -05:00
nick758 029ffd5778 Issue #5066: Create From Screenshot Crash. 2021-01-02 19:06:03 +01:00
Jehan ba4f24e49c plug-ins: set parent_window parameter to Screenshot function of portal…
… org.freedesktop.portal.Desktop (X11 only).
If we don't set this parameter appropriately, the created dialog is not
modal/transient relatively to the main GIMP window. This is especially
annoying because in my tests (GNOME shell), the screenshot dialog would
appear behind GIMP window, which makes it feel like broken behavior.

Note that the supported handles are X11 only so far. We'll need to
generate the appropriate Wayland handles too (created from xdg_foreign
protocol).
2020-12-30 22:22:55 +01:00
Jehan aab1d0c227 plug-ins: do not show our own dialog with Freedesktop screenshot portal.
Today I have only re-tested the GNOME implementation (in particular not
the KDE one) of the portal API org.freedesktop.portal.Screenshot but I
assume it is similar because the dbus function does not provide any
useful options anyway. This is why the portal comes with its own dialog
providing the various common screenshot features (delay, window picking,
area selection, etc.). Showing our dialog first is therefore redundant.

Also I updated setting the monitor profile only in the case where the
loaded image result from the portal did not have an embedded profile. To
be fair, the GNOME implementation at least does not embed a profile to
this day. So this is only for the future case where they will finally do
the right thing and embed the display profile (or for other desktops'
implementations where they maybe already do the right thing).
2020-12-30 17:29:17 +01:00
Jehan a29ece23b9 plug-ins: screenshot_x11_available() should not always return TRUE.
This was true in the "old world" where X11 support being built-in meant
that X11 screenshot would be usable. Now we must not only check it is
built, but also that we are actually running under X11. Otherwise with a
Wayland compositor, screenshot would fail. Also it meant that the
Freedesktop portal was never tried if both X11 and Wayland support were
built-in.
2020-12-30 16:14:13 +01:00
Niels De Graef fa4eb263a0 plug-ins: screenshot: Remove GDK_NATIVE_WINDOW_POINTER
It's a GTK+ 2.0 construct, so anything within such an `#if` will be dead
code anyway.
2020-12-30 12:23:34 +01:00
Jacob Boerema 0d7c26f129 plug-ins: add missing define G_LOG_DOMAIN in file-psd for the meson build. 2020-12-18 14:00:48 -05:00
Jacob Boerema c05abcefc6 plug-ins: fix #4176 color displayed wrong in multi page tiffs with linear TRC.
If we were loading multi page tif images as layers then only the tif pages
that had a color profile attached would get set as linear (and each tiff page
can have a color profile). Since most of the time only the first page has a
color profile this caused us to load linear tiff pages incorrectly.

Also we were overwriting the color profile if there was more than one since
GIMP can only load one per image. Instead of using the last one we see
use the first one and notify if we encounter more than one.
2020-12-18 10:56:45 -05:00
Jehan 9893f60d8c plug-ins: changed GTK_RESPONSE_YES|NO into GTK_RESPONSE_OK|CANCEL.
Without the proper button response associated, we don't have the right
button order, as standardized by various desktops.
2020-12-18 01:24:52 +01:00
Jehan c1c2b8e304 libgimp, plug-ins: add an "(edit)" link next to "Metadata" frame in…
… GimpSaveProcedureDialog.

See issue #6092 and the discussion with Jacob. Basically we are trying
to improve the metadata situation with more edit abilities and
awareness, while in the same time having the export dialogs less of a
mess (the "Comment" input in particular will most likely move to the
metadata editor itself; I left it for now, until the move is done).

The "(edit)" link will basically just run "plug-in-metadata-editor".

Also as a side note: I realized that gimp_pdb_run_procedure() runs
procedures synchronously and wait for a result, which is fine for quick
non-interactive plug-ins, but freezes the calling process otherwise.
Actually even when we want synchronous result, we should allow for GUI
events to be processed (otherwise the OS just thinks the calling export
plug-in is a zombie and proposes to kill it). This API should probably
be improved (and an alternative async version added as well).
2020-12-17 19:11:51 +01:00
Jehan b13502088f libgimp, plug-ins: add a "format name" concept to GimpFileProcedure.
This format name is a public facing name for a file format, such as
"PNG", "JPEG", or "C-source". Since it is public facing, the function
recommends to localize it too.
This is an optional name, yet is made mandatory if you want to use
GimpSaveProcedureDialog because it will be used for the dialog title
(ensuring that all support format have a similar export dialog title).
Following this change, gimp_save_procedure_dialog_new() does not ask for
a title anymore (if anyone absolutely wants to set a custom title,
setting the "title" property on the dialog is always possible anyway,
but a generic and consistent title should be set as a default).

Also updating the 3 plug-ins which were already using the now-changed
API.
2020-12-17 02:13:43 +01:00
Daniel Novomesky 76810d28dd Updated HEIF plug-in
Realtime parameter is set for AOM encoder
when Fast encoding speed is selected by user.
Ability to set pixel format (YUV444, RGB)
is enabled for >= libheif 1.10
to avoid issues in older versions.
2020-12-16 19:35:24 +00:00
Jehan 9a05f24a03 plug-ins: fix uninitialized warnings.
This fixes various similar warnings:

> file-xmc.c:2276:53: warning: ‘save_rgn.height’ may be used uninitialized in this function

Note that I have not looked in details, but it would seem that these are
actually initialized by get_cropped_region() which uses goto-s quite
extensively, so obviously it's hard to follow (for humans as well as for
the compiler). So let's just assume there is no code error and let's
just add default initialization to silence the compiler.
2020-12-15 03:24:02 +01:00
Jehan 0f7c6285ca plug-ins: move py-slice.py to gimp-data-extras.
Per polls on Twitter, Reddit, Patreon and Tipeee, most people were
willing to drop this plug-in as not being relevant anymore (247 for
dropping and 63 for keeping it, so nearly 80% out of 310 participants).

So let's move it to gimp-data-extras allowing it to still have a
possible life, and who knows, maybe to even evolve.

See also corresponding commit beffc6b to gimp-data-extras repository.
2020-12-15 01:46:46 +01:00
François Guerraz 3b3404b03d plug-ins: Set the number of threads used to decode JPEG200 files...
... according to user preferences.
2020-12-11 18:55:44 +01:00
Jehan c94325c670 plug-ins: s/g_get_num_processors/gimp_get_num_processors/ in file-heif. 2020-12-11 18:29:12 +01:00
Jacob Boerema 991e99f08a plug-ins: fix loading 2 and 4 bit tiff images.
This fixes issue #6065 and part of #2680.

Sometime after GIMP 2.8 loading of 2 and 4 bit tif images,
both grayscale and indexed, got broken.

I added routines for handling 2 and 4 bit tifs based on
the handling of 1 bit images.
2020-12-10 18:48:23 -05:00
scootergrisen ac343368ec Change "_Misc Ops." to "_Misc" 2020-12-09 11:32:22 +00:00
dlatikay 9c85faddaa #5977 prompt to apply layer offset only if there actually is a (non-zero) offset 2020-12-02 20:48:48 +00:00
Jehan 965e9ea8b5 plug-ins: return proper non-success status in file-pdf.
When not creating an image, we were always returning with status
GIMP_PDB_EXECUTION_ERROR even though it might have been GIMP_PDB_CANCEL
(which is not handled as an error, this is user choice, hence no dialog
pops up).
2020-12-02 00:20:36 +01:00