Commit Graph

9074 Commits

Author SHA1 Message Date
Jacob Boerema 7bb892f3d5 plug-ins: fix #5313 Exporting to "Gimp pattern" i.e. pat format fails
After the change that allows multiple layers to be selected exporting to
a pattern fails.

Patch this as suggested by Lloyd Konneker by doing the same as for brushes:
do not allow multiple layers, instead only send the first drawable.
2021-08-09 16:28:33 -04:00
Jacob Boerema 4f86d8088d plug-ins: fix #2655 Can't open EPS-files with german Umlauts
Due to differences between Windows and most other platforms Ghostscript
didn't correctly load files with special characters on Windows.

First we needed to make sure that the filenames we use are in utf-8
format and then tell gsapi that we use utf8 encoding.
2021-08-08 19:31:40 -04:00
Jacob Boerema d94a0c00af plug-ins: add non interactive support for extra parameters in file-bmp-save
When exporting to bmp using a script or plug-in we could not set the
parameters use-rle, write-color-space-info, and rgb-format when used
non-interactively.

This is discussed in issue #491. The patch there does not work for master,
so I came up with this.
2021-08-05 16:18:36 -04:00
Michael Bazzinotti 4d528f297f Issue #5415: compensate for null byte
When exporting a C source file with runtime length encoding, the
C-string's array size does not accomodate for the null byte. However,
GIMP accomodates for the NULL byte in it's NON-RLE export, suggesting
that this has been a mere oversight for RLE.

This can cause at the worst a compile-time error and at least a warning
from the compiler.
2021-08-05 19:49:55 +02:00
programmer-ceds 6664b31d68 SF-ADJUSTMENT Slider Duplicate Label Fix 2021-08-04 00:23:04 +00:00
Jacob Boerema 2329fc1656 plug-ins: fix #7086 Can't remove color space from a 1bit monochrome palette
For 1-bit BMP export we did not show the save dialog, making it
impossible to change settings interactively.

We enable the save dialog for 1-bit too, making sure to disable RLE, which
is not available for 1-bit.
In addition, also set the RLE config option to false for all cases where
it can't be used.
2021-08-03 15:40:29 -04:00
Jehan 488e3c4a0a plug-ins: use GimpUi.ProcedureDialog() instead of…
… GimpUi.ProcedureDialog.new()
The old way is still working and acceptable as far as I am concerned.
Just switching to the recommended (by upstream) syntax to show it works
as expected and as a good example of code.
2021-08-03 19:54:55 +02:00
Jacob Boerema e0707af073 plug-ins: fix #1146 DICOM with big endian transfer syntax fails to load.
Our plug-in was not correctly handling DICOM images that use big endian
transfer syntax, which is deprecated.

We add support for that here, add a few g_debug statements to make future
debugging easier, and also return an error when we encounter a transfer
syntax that we can't handle instead of blindly continuing.
2021-07-23 14:55:37 -04:00
Jacob Boerema 3733a36d84 plug-ins: add support for planar configuration in DICOM images.
Part 1 of the fix for #1146.

In addition to that we also add some g_debug statements to make it easier
to determine certain image info.
2021-07-23 14:55:37 -04:00
Michael McLaughlin 3b3f34cd22 Issue #6994: Color Noise produces artifacts with highly saturated…
… source colors

Reviewer's (Jehan) note: a git blame shows this is a clear bug
introduced in commit 9d19bf2a3e, which was a cleanup patch, and the
BOUNDS() macro was not doing exactly the same thing as the code before
the change.
2021-07-17 18:58:16 +02:00
Michael Schumacher 7f0dafe571 plug-ins: use #!/usr/bin/env python3 shebang line in python-console.py
Fixes #7035.
2021-07-07 17:47:15 +02:00
Mayank Suman d8062d1d77 plug-in, libgimp: Fixes #6753: redesign of WebP Export dialog
Added an option for exporting thumbnail in WebP Export dialogbox.

Additionally, introduced a function gimp_procedure_dialog_fill_expander.
The function is similar to gimp_procedure_dialog_fill_frame but allows
adding GtkExpander instead of GtkFrame.
2021-06-18 16:42:08 +05:30
Jacob Boerema 1731c875a1 plug-ins: fix the fix for #6116 grayscale gif animation.
I must have not been awake yet when I pushed the
fix for #6116 because it has two problems:
- Updating cur_progress caused by not editing the
  for loop after a copy/paste, found thanks to
  Stanislav Grinkov.
- Not using the correct drawable to determine the
  drawable_type which I noticed while fixing the
  above issue.

These issues are not present in the backported
version for 2.10.
2021-05-31 11:59:58 -04:00
Marie-P c112a55958 libgimp*, plug-ins: fix some warnings 2021-05-24 20:36:31 +00:00
lloyd konneker e57304f71a Issue #5402 Scriptfu handle GFile and GimpObjectArray types 2021-05-24 13:28:50 +00:00
Stanislav Grinkov f8320ce535
core: minor memleak fixes
Fix several memory leaks when uri obtained by g_file_get_uri ()
was not g_free'd ().
2021-05-23 20:57:44 +06:00
Jacob Boerema 3b3ab0aa11 plug-ins: fix #6116 grayscale gif animation hangs on export.
GIF export was not taking into account that there can be
both grayscale layers with and without alpha in an image.

We make sure that the GEGL buffer knows the type of
drawable for the current layer.
2021-05-19 17:38:32 -04:00
Jacob Boerema 016948c482 plug-ins: load 16-bit per sample SGI images as 16 bit integer
We were loading 16-bit per sample SGI images as 8-bit
integer images even though we have had support for
16-bit integer for a long time now.

Changed to use 16-bit integer encoding now. Saw
this request a while ago on the gimp user mailing list.
2021-05-18 18:53:59 -04:00
Jacob Boerema e1fcaaaa0a plug-ins: always stop on error after reading PSD layer block. 2021-05-17 21:27:07 -04:00
Jacob Boerema be20a25ec6 plug-ins: additional layer info in PSD images can have multiple resources.
Instead of only checking for the layer resources Lr16 and Lr32 make it
a loop and use the generic get_layer_resource_header to read all
resources.

We still need to figure out at a later time how to best handle these
resources.
2021-05-17 21:27:07 -04:00
Jacob Boerema d99b87c529 plug-ins: add support for reading Photoshop PSB image files. 2021-05-17 21:27:07 -04:00
Jacob Boerema 35f4b7b517 plug-ins: make PSD resource loading handle 64-bit lengths.
For PSB images certain resources have 64-bit lengths.
Let's handle this transparently by adding a psd_version
parameter and depending on that and the type of
resource we decide if the length to read is 32 or 64-bit.

We also return the total header size. This way the
calling function can use that to determine the
remaining length.

Because we needed to check the signature when
loading the header we remove that check from
the load_layer_resource function since that
would be redundant.
2021-05-17 21:27:06 -04:00
Jacob Boerema 6f523d33dd plug-ins: adjust some psd-load debug statements for 64-bit. 2021-05-17 21:27:06 -04:00
Jacob Boerema 2df0569a50 plug-ins: PSD ChannelLengthInfo data_len should be 64 bit. 2021-05-17 21:27:06 -04:00
Jacob Boerema 0de02a5b2d plug-ins: PSD layer size validation only for "normal" layers.
Apparently layer height or width can be negative for certain
PSD layers that have the irrelevant flag set.

We move those checks down until after we have read that
flag and only validate if the irrelevant flag is not set.
2021-05-17 21:27:06 -04:00
Jacob Boerema f82974a70e plug-ins: in psd-load.c change debug state to 4 for 1 bit conversion details.
Since the 1-bit conversion debug statements causes a huge amount
of info which can cause slowdowns when loading do it only when
explicitly setting it to IFDBG(4).
2021-05-17 21:27:06 -04:00
Jacob Boerema 714052e998 plug-ins: remove outdated comment about GIMP_MAX_IMAGE_SIZE in psd-load.c
GIMP_MAX_IMAGE_SIZE is nowadays 524288.
2021-05-17 21:27:06 -04:00
Jacob Boerema 2e2e43a404 plug-ins: add psd_read_len function
In certain places in a PSB file we need to read 64-bit
lengths where in a PSD we read a 32-bit length.

To make handling this easier we add a function that
determines if we need to read 4 or 8 bytes and 
also handles converting the value from big endian.
2021-05-17 21:27:06 -04:00
Jacob Boerema 0a703115d1 plug-ins: increase MAX_CHANNELS in PSD files to 99.
Even though the current specs say max is 56 there
are sample files with more channels. Since there is
no reason why we can't handle more let's increase
the maximum to 99 for now.
2021-05-17 21:27:06 -04:00
Jacob Boerema 32be0ec709 plug-ins: PSD layer name can be NULL.
Apparently in a PSD a layer name can be NULL which
gimp_item_set_name doesn't like so only use it when
we have a valid layer name.
2021-05-17 21:27:06 -04:00
Jacob Boerema 58183e55c6 plug-ins: store PSD file version in our PSDimage data structure. 2021-05-17 21:27:05 -04:00
Jacob Boerema 82cb11eb54 plug-ins: add extra safety checks in psd-load.
Add some extra check when loading  masks to
detect problems and in some cases try to fix them
by skipping the problematic data.
2021-05-12 17:55:29 -04:00
Jacob Boerema eb78aa994e plug-ins: fix computation of padding in fread_unicode_string. 2021-05-12 17:55:29 -04:00
Jacob Boerema 3da302adce plug-ins: consider reading less bytes than we need an error in psd-util. 2021-05-12 17:55:29 -04:00
Jacob Boerema 670ef6b9a3 plug-ins: fix setting error message in psd-util. 2021-05-12 17:55:29 -04:00
Jacob Boerema 3d248dc66f plug-ins: PSD color block can have a non zero length even when mode is RGB.
Not taking a non zero length into consideration caused us to read from the
wrong location in certain cases and then fail loading.

Always use the specified length to go to the correct location. This is not
a guarantee that we will be able to correctly load the image but at least
we won't read wrong data from the wrong location.
2021-05-12 17:55:28 -04:00
Jacob Boerema 666ae4ecfe plug-ins: don't use G_GSIZE_FORMAT specifier in translatable string in psd-load.
See: 38c0344fa8 (note_1103992)
2021-05-12 17:55:28 -04:00
Jehan 9b033f8996 plug-ins: fix creating multiple preview display for JPEG export.
Commit aba721ae68 fixed its intended bug but brought a new: each time
the preview was updated, a new display was created. This fixes this new
bug. Hopefully it's good now!
2021-05-12 22:46:52 +02:00
Jacob Boerema 38c0344fa8 plug-ins: fix #5944 Unable to open XCF converted PSD files
in Gimp and Photoshop- "Too many channels in layer: 4907"

To be better able to handle 64 bit offsets we switch to
using GInputStream/GOutputStream and its related
functions instead of using FILE functions like fseek.

In addition we changed several offsets and sizes to
64 bit instead of 32 bit to correctly handle large
image sizes and offsets.

I should probably have split this out in two parts
(the move to GInput/OutputStream, and the
changing to 64 bit variables) but don't feel like
it's worth the trouble at this point.
2021-05-11 12:34:41 -04:00
Jacob Boerema 8fdeaddbe7 plug-ins: fix using wrong offset for group layer masks in psd export.
Exporting to psd could result in very large files which often failed to
load in both GIMP and PS when a group layer with a layer mask
was present.

Reported on our IRC channel with a sample xcf which made it
possible to figure out the problem.
2021-05-04 15:48:34 -04:00
Jehan 4f1007edbc Issue #6695: Wrong tab after JPG export because of "Show preview"…
… feature.
Using the new gimp_display_present() function in file-jpeg to make sure
the original display is back to the top.
2021-04-30 03:51:21 +02:00
Jehan aba721ae68 Issue #6280: JPEG preview window doesn't get closed.
The port had a slight error, because in gimp-2-10, the display_ID
actually had 3 states: 0 when gimp_export_image() kept the original
image to which we just add a preview layer, -1 when it created a new
image which we wanted to put in its own display, and the display ID
itself when created.

With the new API where display variable is an object, we can only have 2
cases. So I create an additional variable separate_display to make the
distinction.
2021-04-30 01:35:51 +02:00
Jacob Boerema fe228a6f6f plug-ins: fix #5960 Gimp loads 16 bit DDS images with luminosity as 8 bit.
So far all dds images were loaded as 8 bit per channel which makes
sense for most but not all dds formats.

This commit implements loading in 16 bit for "L16" - a 16 bit
luminance channel.

In addition to that we improve security a bit  by not assuming
that L16 is the only left over case but instead explicitly
checking the correct value of rmask for L16.

For other cases we now set an error with enough details
to identify the type of DDS image that needs extra
handling.
2021-04-26 17:35:04 -04:00
Jehan ef2402bf8e app, libgimp, pdb, plug-ins: allow pasting multiple full layers.
When a selection exists, we are copying then pasting the selection
contents. In particular, with multi-layer selection, it means pasting a
merged result of the selected layers (like a sample merged but limited
to selected layers).

Yet when no selection exists, with a single layer selected, a cut in
particular would remove the layer fully, then a paste would copy it
elsewhere (in the same image or even on a different image). This was
still working, but not with multiple layers. This is now fixed and we
can now copy/cut then paste several layers (without merge), which is
sometimes a very practical way to move layers (sometimes simpler than
drag'n drop, especially between images).

As a consequence, the PDB function gimp_edit_paste() now also returns an
array of layers (not a single layer).
2021-04-24 23:22:58 +02:00
Jacob Boerema 165b50abcc plug-ins:fix #6624 metadata viewer default window size is too small
Let's increase the default size of the metadata viewer a bit.
Ideally we would add some logic to determine the width of
the first column since that one currently depends on the
length of the longest tag. However for now this change
will be enough for most cases.
2021-04-24 12:45:52 -04:00
Jacob Boerema ed35579861 script-fu: fix #6741 Round Corners script fails to work on layer masks
The round corners script was assuming that the drawable always
was a layer, which is incorrect when a layer mask is selected.

We fix this by always requesting the active layer instead of
active drawable.

We also enable this script for RGB and GRAY with alpha
channel. Although it might not always make sense to
use this script when an alpha channel is present, there
can be use cases where it is perfectly fine.

So let the designer decide if this script is suited or not
instead of GIMP making that judgement.
2021-04-24 12:41:41 -04:00
Jehan 69fdcf5d3f plug-ins: use g_mkdir() for generic cross-platform code.
This fixes the following error when building for Windows:

> error: too many arguments to function ‘mkdir’

On Windows, mkdir() is deprecated, it is an alias for _mkdir() which
doesn't have a mode parameter. The GLib version duplicates the POSIX
signature and is cross-platform (mode is simply ignored on Windows).
2021-04-24 17:03:43 +02:00
saul 11906fa82c plug-ins: Add 'dir-make' procedure to Script-fu.
Closes: GNOME/gimp#541

Reviewer note: thanks to Stanislav Grinkov for cleaning up and reworking
a bit the patch, such as renaming the procedure to dir-make, as per
Kevin Cozens' review.
2021-04-24 15:09:24 +02:00
Jacob Boerema cad6273fed plug-ins: fix #6755 DDS RGB10A2 has Red and Blue swapped.
Looking at the documentation it is indeed red that should go
in the lowest bits and blue in the highest bits so just
reverse our code for red and blue.

We also update the version of our GIMP DDS plug-in,
this way we can catch and correct RGB10A2 images
written by older versions of our plug-in and correct
them.
2021-04-23 14:31:50 -04:00
bootchk 877d585271 Partial fix 5426. Lets old scriptfu script call old name gimp-image-is-valid,
mapped to new PDB procedure gimp-image-id-is-valid (same signature), for example.

Edit a few comments in new code.

Style changes, no logic change.
2021-04-22 11:27:22 -04:00